2

In help(predict.lars) we can read that the parameter s is "a value, or vector of values, indexing the path. Its values depends on the mode= argument. By default (mode="step"), s should take on values between 0 and p (e.g., a step of 1.3 means .3 of the way between step 1 and 2.)"

What does "indexing the path" mean? Also, s must take a value between 1 and p, but what is p? The parameter p is not mentioned elsewhere in the help file.

I know this is basic, but there is not a single question up on SO about predict.lars.

Dr. Beeblebrox
  • 838
  • 2
  • 13
  • 30
  • Questions like "what does this statistical parameter mean" are probably best suited to CrossValidated; this isn't a programming problem which is what SO is for. – Hong Ooi Jun 21 '13 at 16:08
  • 2
    This question appears to be off-topic because it is about interpreting statistical results. – Thomas Jul 23 '13 at 09:29
  • @HongOoi The question is about R programming, not stats. I want to know how to use a command and the help file is unclear. The command calls for `p` input but doesn't tell the reader what that is. That's an R question. @Thomas The question is not about *interpreting* results. – Dr. Beeblebrox Aug 08 '13 at 16:48

1 Answers1

3

It is easiest to use the mode="norm" option. In this case, s should just be your L1-regularization coefficient (\lambda).

To understand mode=step, you need to know a little more about the LARS algorithm.

One problem that LARS can solve is the L1-regularized regression problem: min ||y-Xw||^2+\lambda|w|, where y are the outputs, X is a matrix of input vectors, and w are the regression weights.

A simplified explanation of how LARS works is that it greedily builds a solution to this problem by adding or removing dimensions from the regression weight vector.

Each of these greedy steps can be interpreted as a solution to a L1 regularized problem with decreasing values of \lambda. The sequence of these steps is known as the path.

So, given the LARS path, to get the solution for a user-supplied \lambda, you iterate along the path until the next element is less than the input \lambda, then you take a partial step (\lambda decreases linearly between each step).

user1149913
  • 4,463
  • 1
  • 23
  • 28