[R] Question about the prediction plot in pls package
Bjørn-Helge Mevik
b.h.mevik at usit.uio.no
Tue Sep 3 08:18:40 CEST 2013
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
More information about the R-help
mailing list