[R] PLS Error message

Bjørn-Helge Mevik b.h.mevik at usit.uio.no
Tue Mar 6 15:51:09 CET 2012


Thomas Möckel <thomas.mockel at nateko.lu.se> writes:

> I work with hyperspectral remote sensing data and I try to built a pls 
> model with this data. I already built the model but if I try to 
> calculate the RMSEP and R2 with a test data set I get the following 
> error message:
>
> Error: variable 'subX' was fitted with type "nmatrix.501" but type 
> "nmatrix.73" was supplied

Since you don't show what commands you used, this is guesswork, but my
guess is that you used

yourmodel <- plsr(yourresponse ~ subX, data = yourdata)
R2(yourmodel, newdata = yournewdata)

and that yourdata$subX contains 501 coloumns, but yournewdata$subX only
contains 73 coloumns.  You must supply a newdata with the same number of
coloumns as in the modelling data.

-- 
Regards,
Bjørn-Helge Mevik



More information about the R-help mailing list