Re: [R] lasso constraint

2012-03-27 Thread Steve Lianoglou
Hi, On Tue, Mar 27, 2012 at 10:35 AM, yx78 wrote: > In the package lasso2, there is a Prostate Data. To find coefficients in the > prostate cancer example we could impose L1 constraint on the parameters. > > code is: > data(Prostate) >  p.mean <- apply(Prostate, 5,mean) >  pros <- sweep(Prostate,

Re: [R] lasso constraint

2012-03-27 Thread Bert Gunter
Inline: On Tue, Mar 27, 2012 at 10:00 AM, Weidong Gu wrote: > Hi, > > your code has errors: apply function only has 1 or 2 as margin. FALSE. Please re-read the Help files. It works as expected with arbitrary higher dim arrays. -- Bert > > bound is used as turning parameter for summation of a

Re: [R] lasso constraint

2012-03-27 Thread Weidong Gu
Hi, your code has errors: apply function only has 1 or 2 as margin. bound is used as turning parameter for summation of absolute coefficients. lasso runs on a grid of the turning parameter for varying strength of shrinkage. so each turning value may yield different sets of coefficients and values

[R] lasso constraint

2012-03-27 Thread yx78
In the package lasso2, there is a Prostate Data. To find coefficients in the prostate cancer example we could impose L1 constraint on the parameters. code is: data(Prostate) p.mean <- apply(Prostate, 5,mean) pros <- sweep(Prostate, 5, p.mean, "-") p.std <- apply(pros, 5, var) pros <- swe