Skip to content

lars - lasso problem

2 messages · Steve Lianoglou, gauri j

#
Hi,

First: Please make sure you CC R-help when responding to messages on
the list so that more people can help you, and more people can benefit
from help that is provided. You can do so easily by replying with
"reply-all."

Now:
Look at the help for the lars function:

R> ?lars

You'll see that `x` should be a matrix. I guess it doesn't say as
much, but `y` should be a (numeric) response.

Both of x and y in your case are data.frames. Convert them to the
appropriate objects and try again, eg:

R> x <- as.matrix(x)
R> y <- as.numeric(y[,1])

Now make sure that these objects look right by (among other things)
examining the output of:

R> head(x)
R> head(y)

Then try lars again.

Also, I'd suggest using the glmnet package instead of lars. It's
written by the same people and you'll get both the lasso and
elasticnet under one roof.

-steve
On Fri, Apr 8, 2011 at 1:54 PM, gauri j <gauri.jape7 at gmail.com> wrote: