[R] FW: lasso regression

David Winsemius dwinsemius at comcast.net
Tue Jul 12 16:07:55 CEST 2011


On Jul 12, 2011, at 9:53 AM, Heiman, Thomas J. wrote:

> Hi,
>
> I am trying to do a lasso regression using the lars package with the  
> following data (see attached):

Nothing attached. (And now you have also sent an exact duplicate.)

snipped failed attempt to include data inline that was sabotaged by  
using HTML mail
>
>
>
> #load Data
> crs<- read.csv("file:///C:/temp/Horse//horseracing.csv<file:///C:\temp\Horse\horseracing.csv 
> >", na.strings=c(",", "NA", "", "?"), encoding="UTF-8")

This looks wrong. Your data had no commas in it and you are also  
setting na.strings to include commas. If I am wrong then you should  
provide dput on crs instead of

>
> #    # 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
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list