[R] FW: lasso regression
Heiman, Thomas J.
theiman at mitre.org
Tue Jul 12 15:50:30 CEST 2011
Hi,
I am trying to do a lasso regression using the lars package with the following data (see attached):
FastestTime
WinPercentage
PlacePercentage
ShowPercentage
BreakAverage
FinishAverage
Time7Average
Time3Average
Finish
116.90
0.14
0.14
0.29
4.43
3.29
117.56
117.77
5.00
116.23
0.29
0.43
0.14
6.14
2.14
116.84
116.80
2.00
116.41
0.00
0.14
0.29
5.71
3.71
117.24
117.17
4.00
115.80
0.57
0.00
0.29
2.14
2.57
116.21
116.53
6.00
117.76
0.14
0.14
0.43
5.43
3.57
118.57
118.87
3.00
117.69
0.14
0.14
0.00
4.71
4.00
118.69
118.60
6.00
116.46
0.14
0.00
0.00
5.14
5.00
118.50
118.97
5.00
119.77
0.00
0.00
0.14
4.57
4.14
120.74
121.03
4.00
116.81
0.14
0.29
0.00
4.86
3.57
117.63
117.40
5.00
117.66
0.14
0.14
0.14
4.57
4.71
119.19
120.57
7.00
#load Data
crs<- read.csv("file:///C:/temp/Horse//horseracing.csv<file:///C:\temp\Horse\horseracing.csv>", na.strings=c(",", "NA", "", "?"), encoding="UTF-8")
# # define x and y
x= x<-crs[,9] #predictor variables
y= y<-crs[1:8,] #response variable
library(lars)
cv.lars(x, y, K=10, trace=TRUE, plot.it = TRUE,se = TRUE, type="lasso")
and I get:
LASSO sequence
Error in one %*% x : requires numeric/complex matrix/vector arguments
Any idea on what I am doing wrong? Thank you!!
Sincerely,
tom
More information about the R-help
mailing list