[R] Help concerning Lasso::l1ce

Martin Maechler maechler at stat.math.ethz.ch
Fri Feb 11 21:32:58 CET 2005


>>>>> "Feng" == Feng Qiu <fengqiu1984 at yahoo.com>
>>>>>     on Fri, 11 Feb 2005 01:01:06 -0800 (PST) writes:

    Feng> Hi, 
    Feng> First, when I try the example Prostate with bound 0.44
    Feng> (as in the manual), I got a different result:
	                              ^^^^^^^^^
different than the manual?  I get the same result as you do.
and I see that example in the manual seems to first transform
the data so I wouldn't expect the same answer...

    Feng> And the sum of the absolute values of the coefficients
    Feng> are larger than the bound!! Why?

because they are (back) transformed from the so called
"constrained coefficients"

    Feng> Second, the manual says that if I set sweep.out to
    Feng> NULL, the constant term (which is the intercept,
    Feng> right?)
    Feng> will be included in the bound, but when I do so, I get
    Feng> an error "Matrix build from transformed variables has
    Feng> a constant column". 

because the intercept is a constant column in your matrix.
You need to additionally say "standardize = FALSE",
and things will work (see below).

    Feng> And how can I constrain the constant term?

as mentioned above. Here is the call and the "proof" that the
constrained coefficients follow the bound :

Input:
 
  library(lasso2)
  data(Prostate)
  l1c.P. <- l1ce(lpsa ~ ., Prostate, bound=0.44, sweep= NULL, standardize=FALSE)
  l1c.P.
  sum(l1c.P. $ constrained.coefficients)


Transcript :

 > l1c.P. <- l1ce(lpsa ~ ., Prostate, bound=0.44, sweep=NULL, standardize=FALSE)
 > l1c.P.
 Call:
 l1ce(formula = lpsa ~ ., data = Prostate, sweep.out = NULL, standardize = FALSE, 
     bound = 0.44)

 Coefficients:
 (Intercept)      lcavol     lweight         age        lbph         svi 
 0.000000000 0.559056488 0.393462929 0.000000000 0.042394403 0.198590534 
	 lcp     gleason       pgg45 
 0.000000000 0.015171790 0.005224389 

 The relative L1 bound was      : 0.44 
 The absolute L1 bound was      : 1.213901 
 The Lagrangian for the bound is:  5.340326 
 > sum(l1c.P. $ constrained.coefficients)
 [1] 1.213901
 > 

    Feng> Finally, could anyone explain to me the difference
    Feng> between relative bound and absolute bound? Which is
    Feng> the actually bound adopted?

I think you should read the reference mentioned
and/or also see how l1ce() computes its quantities.
Just type  ` l1ce '  to see the function definition (apart from
the few comments in the source code).


    Feng> I’m new to R and the lasso2 package, please help
    Feng> me out, thank you very much.

you're welcome.
Martin Maechler


BTW: I'll be gone for vacations, so please continue this topic
     on R-help  (and keep me out of CC: if you know how).




More information about the R-help mailing list