Hi, I'd like to draw the trained predictions and the cross-validated predictions in the same plot to compare two predictions. In page 3, in the pls Package paper, R> plot(gas1, ncomp=2, asp = 1, line = TRUE) This shows only the cross-validated predictions. Could you tell me how to do? Thank you in advance! [[alternative HTML version deleted]]
Bjørn-Helge Mevik
2013-Sep-03 06:18 UTC
[R] Question about the prediction plot in pls package
Euna Jeong <eajeong at gmail.com> writes:> R> plot(gas1, ncomp=2, asp = 1, line = TRUE) > > This shows only the cross-validated predictions.If you add the argument which = c("train", "validation") (see ?predplot.mvr), you will get both. However, you will get them in separate panels in the plot. If you wish to have them in the same panel, you will have to add the points yourself. This should work: plot(gas1, ncomp=2, asp = 1, line = TRUE) points(predict(gas1, ncomp = 2) ~ gasoline$octane, col = "red") -- Regards, Bj?rn-Helge Mevik