[R] problem with pls(x, y, ..., ncomp = 16): Error in inherit s( x, "data.frame") : subscript out of bounds
Ron Wehrens
rwehrens at sci.kun.nl
Wed Dec 10 09:41:04 CET 2003
On Wednesday 10 December 2003 05:14, Liaw, Andy wrote:
> My first guess was wrong (should have RTFM...). Try:
>
> m <- pls(x, y, validation = "CV", niter = 68, ncomp = 1:16)
>
> I'm not familiar enough with SIMPLS to know whether it makes sense to pass
> ncomp of length 1 to pls(), but the code as is won't work (unless ncomp=1).
> The problem is in the following two lines inside simpls():
>
> YvarExpl <- matrix(0, length(ncomp), npred)
> for (i in 1:max(ncomp)) YvarExpl[i, ] <- diag(cor(Y, X %*% B[, , i]))^2
>
> If ncomp is of length 1, then YvarExpl is a 1x1 matrix, so the loop will
> bomb if ncomp > 1.
>
> [I'm CC'ing Prof. Wehrens, who is the package maintainer.]
>
> HTH,
> Andy
Thanks for spotting this! I'll correct it asap.
Ron
--
Ron Wehrens
Dept. of Chemometrics
University of Nijmegen Email: rwehrens at sci.kun.nl
Toernooiveld 1 http://www.cac.sci.kun.nl
6525 ED Nijmegen Tel: +31 24 365 2053
The Netherlands Fax: +31 24 365 2653
More information about the R-help
mailing list