[R] FW: lasso regression
Heiman, Thomas J.
theiman at mitre.org
Tue Jul 12 16:12:24 CEST 2011
Hi,
Hopefully I got the formatting down.. I am trying to do a lasso regression using the lars package with the following data (the data files is in .csv format):
V1 V2 V3 V4 V5 V6 V7 V8 V9
1 FastestTime WinPercentage PlacePercentage ShowPercentage BreakAverage FinishAverage Time7Average Time3Average Finish
2 116.9 0.14285715 0.14285715 0.2857143 4.428571 3.2857144 117.557144 117.76667 5.0
3 116.22857 0.2857143 0.42857143 0.14285715 6.142857 2.142857 116.84286 116.8 2.0
4 116.41428 0.0 0.14285715 0.2857143 5.714286 3.7142856 117.24286 117.166664 4.0
5 115.8 0.5714286 0.0 0.2857143 2.142857 2.5714285 116.21429 116.53333 6.0
#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