[R] partial least regression
Gabor Grothendieck
ggrothendieck at gmail.com
Wed May 16 16:26:54 CEST 2007
Your call to mvr does not correspond to the documentation. See ?mvr
and try this:
Lines <- "x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 y1
17 5 77 18 19 24 7 24 24 72 52 100
2 6 72 18 17 15 4 12 18 35 42 97.2
17 2 58 10 5 3 4 3 3 40 28 98
17 2 69 14 13 12 4 6 6 50 37 93
2 3 75 20 38 18 6 12 18 73 67 99
14 4 59 16 18 9 4 3 15 47 40 99.95
17 4 87 18 17 12 4 15 12 69 46 100
14 3 74 15 9 12 1 15 12 44 35 98
17 6 76 15 33 21 15 9 18 46 41 100
17 5 76 17 22 18 1 15 9 54 38 100
20 16 98 23 43 27 27 24 27 87 67 99.9
20 6 110 25 36 18 7 18 12 99 88 90
20 6 100 20 19 18 4 15 21 84 60 99.2
17 6 72 13 31 18 5 21 12 52 43 95.6
20 15 104 25 53 30 31 30 30 100 90 99.93
17 13 68 21 42 24 14 18 12 75 69 99.1
17 8 63 14 18 9 10 15 25 39 38 95
20 7 88 19 28 18 7 15 24 61 49 100
20 14 61 18 48 15 11 21 18 48 48 99.91
20 9 94 22 38 21 13 31 12 84 80 99.43
17 7 70 16 28 12 18 12 12 52 38 100
17 6 80 17 46 18 18 24 18 70 69 99.2
"
library(pls)
quality.data <- read.table(textConnection(Lines), header = TRUE)
pairs(quality.data[c("x4", "x5", "y1")])
quality.simpls <- mvr(y1 ~., ncomp = 6, quality.data, method = "simpls",
validation = "CV") # replace 6 with whatever you want
On 5/16/07, ÕÔÓñÖÒ <zhaoy at ysu.edu.cn> wrote:
> hello r-helpers:
> there is a .txt file:
> x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 y1
> 17 5 77 18 19 24 7 24 24 72 52 100
> 2 6 72 18 17 15 4 12 18 35 42 97.2
> 17 2 58 10 5 3 4 3 3 40 28 98
> 17 2 69 14 13 12 4 6 6 50 37 93
> 2 3 75 20 38 18 6 12 18 73 67 99
> 14 4 59 16 18 9 4 3 15 47 40 99.95
> 17 4 87 18 17 12 4 15 12 69 46 100
> 14 3 74 15 9 12 1 15 12 44 35 98
> 17 6 76 15 33 21 15 9 18 46 41 100
> 17 5 76 17 22 18 1 15 9 54 38 100
> 20 16 98 23 43 27 27 24 27 87 67 99.9
> 20 6 110 25 36 18 7 18 12 99 88 90
> 20 6 100 20 19 18 4 15 21 84 60 99.2
> 17 6 72 13 31 18 5 21 12 52 43 95.6
> 20 15 104 25 53 30 31 30 30 100 90 99.93
> 17 13 68 21 42 24 14 18 12 75 69 99.1
> 17 8 63 14 18 9 10 15 25 39 38 95
> 20 7 88 19 28 18 7 15 24 61 49 100
> 20 14 61 18 48 15 11 21 18 48 48 99.91
> 20 9 94 22 38 21 13 31 12 84 80 99.43
> 17 7 70 16 28 12 18 12 12 52 38 100
> 17 6 80 17 46 18 18 24 18 70 69 99.2
>
> and i write this program:
> library(pls)
> quality.data<-read.table("d:\\work\\12.txt",col.names=c("x1","x2","x3","x4",
> "x5","x6","x7","x8","x9","x10","x11","y1"))
> attach(quality.data)
> quality.data #
> pairs(cbind(x4,x5,y1))
> X<-data.frame(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,y1)
> Y<-data.frame(y1)
> quality.simpls<-mvr(X,Y,1:11,method="simpls",validation="CV") #####error
> happens in this row ,and the error information is about: error in
> :eval(expr, envir, enclos) :the length of number'envir' is not 1.
>
> i don't know how to solve this problem.
> who can help me make this program correct,please. thank you very much!
>
> kenneth
>
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list