[R] R2 function from PLS to use a model on test data

Addi Wei addiwei at gmail.com
Wed Jul 7 21:49:40 CEST 2010


Hello,  
   I am having some trouble using a model I created from plsr (of train) to
analyze each invididual R^2 of the 10 components against the test data.  For
example:

mice1 <- plsr(response ~factors, ncomp=10 data=MiceTrain)
R2(mice1)    ##this provides the correct R2 for the Train data for 10
components
## Now my next objective is to calculate my model's R2 for each component on
the Test data. (In other words - test how good the model is on test data) 
The only thing I need are the MiceTest.response, and compare that with
predict(mice1, ncomp=1, newdata=MiceTest , and I should be able to calculate
R2.....but I can't figure out the correct command to do this.   I tried the
command below, which does provide a different R2 response, however, I'm not
sure it is correct as I get a different R^2 value from another software MOE
( Molecular Operating Environment ).

R2(mice1, estimate="test", MiceTest)

Is the above the correct code to achieve what I'm doing?  If so, then MOE
probably uses a different function to calculate the model component's R^2
for Test data.

Thanks in advance.  
-- 
View this message in context: http://r.789695.n4.nabble.com/R2-function-from-PLS-to-use-a-model-on-test-data-tp2281426p2281426.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list