[R] "mvr" function

From: Jim BRINDLE <j_brindle_at_hotmail.com>
Date: Thu 02 Jun 2005 - 07:02:56 EST


I am trying to understand how to utilize the "mvr" function in the pls Package of R. I am utilizing the R "pls Package" document dated 18 May 2005 as guidance. My data set consists of a 12 x 12 data frame created from reading in a table of values. I have read the data in via the command:

volumes <- read.table("THA_vol.txt", header = TRUE)

and then created a data.frame called "vol". My response variable is in the last column of the "vol" data frame and my dependent variables are in columns 1 through 11.

To familiarize myself with this approach I have utilized the NIR data set (included in the pls Package). I get the following command to work with the NIR data set:

NIR.pcr <- pcr(y ~ X,6,data=NIR,validation="CV")

However, when I run the following script which effectively substitutes my data set (& modify variable names accordingly) into the above equation:

y <- vol[,12]
X <- vol[,1:11]
ans.pcr <- pcr(y ~ X,6,data=vol,validation="CV")

I get the following error:

Error in model.frame(formula, rownames, variables, varnames, extras, extranames, :

       invalid variable type

I have looked at the NIR data set in the pls Package and tried to see how it "structurally" differs from my data-set "structure" (other than in its size).

Does anyone have any insight they might be willing to share?

Thank you kindly.

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jun 02 07:06:50 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:21 EST