[R] "mvr" function
Jim BRINDLE
j_brindle at hotmail.com
Wed Jun 1 23:02:56 CEST 2005
Hello,
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.
- Jim
More information about the R-help
mailing list