Question: lower.limits and upper.limits in glmnet
0
5.4 years ago by
Yue Li370
USA
Yue Li370 wrote:
Dear List, A quick question about using the glmnet package (which I know is not a BioC package ... apologies): Would the options "upper.limits" and "lower.limits" in glmnet be equivalent to an additionally constrained optimization on the range of the coefficients? For instance, would setting upper.limits to 0 be equivalent to a non- positive least squared linear regression (regularized)? Any helps are greatly appreciated! Many thanks, Yue
regression • 1.6k views
modified 5.4 years ago by Yue Li60 • written 5.4 years ago by Yue Li370
Answer: lower.limits and upper.limits in glmnet
0
5.4 years ago by
Yue Li60
Yue Li60 wrote:
Dear List, A quick question about using the glmnet package (which I know is not a BioC package ... apologies): Would the options "upper.limits" and "lower.limits" in glmnet be equivalent to an additionally constrained optimization on the range of the coefficients? For instance, would setting upper.limits to 0 be equivalent to a non- positive least squared linear regression (regularized)? Any helps are greatly appreciated! Many thanks, Yue
Hi, On Mon, Oct 21, 2013 at 10:51 AM, Yue Li <yueli at="" cs.toronto.edu=""> wrote: > Dear List, > > A quick question about using the glmnet package (which I know is not a BioC package ... apologies): > > Would the options "upper.limits" and "lower.limits" in glmnet be equivalent to an additionally constrained optimization on the range of the coefficients? > > For instance, would setting upper.limits to 0 be equivalent to a non-positive least squared linear regression (regularized)? Reading the documentation for those parameters in the ?glmnet docs certainly suggests so, no? This is simple enough for you to try yourself, though, so why not just give it a shot and report back with your results? -steve -- Steve Lianoglou Computational Biologist Bioinformatics and Computational Biology Genentech
Hi Steve, Thanks for the reply. Yes, I tried it and it does seem to do that. I was just uncertain about how is achieved. Thanks anyways. Input: mycoef1 <- as.matrix(coef(glmnet(x,y,alpha=1,intercept=F),s=0.01)) mycoef2 <- as.matrix(coef(glmnet(x,y,alpha=1,intercept=F,upper.limits= c(rep(Inf,5), rep(0,15))),s=0.01)) print(cbind(mycoef1, mycoef2)) Output: 1 1 (Intercept) 0.000000000 0.000000000 V1 0.073877294 0.066218767 V2 0.034539506 0.004229772 V3 0.056682635 0.061373751 V4 -0.048408058 -0.067313603 V5 0.000000000 0.001866883 V6 -0.027033061 -0.024216745 V7 -0.053746653 -0.048835781 V8 0.151853999 0.000000000 V9 0.006023245 0.000000000 V10 0.007404765 0.000000000 V11 -0.087274939 -0.129084080 V12 0.019070975 0.000000000 V13 -0.031480104 -0.024312149 V14 0.075601445 0.000000000 V15 -0.021138293 -0.015392988 V16 0.013038938 0.000000000 V17 -0.046345120 -0.043179775 V18 -0.166853254 -0.158282024 V19 -0.051904691 -0.025384641 V20 -0.008883316 0.000000000 On 2013-10-21, at 2:13 PM, Steve Lianoglou <lianoglou.steve at="" gene.com=""> wrote: > Hi, > > On Mon, Oct 21, 2013 at 10:51 AM, Yue Li <yueli at="" cs.toronto.edu=""> wrote: >> Dear List, >> >> A quick question about using the glmnet package (which I know is not a BioC package ... apologies): >> >> Would the options "upper.limits" and "lower.limits" in glmnet be equivalent to an additionally constrained optimization on the range of the coefficients? >> >> For instance, would setting upper.limits to 0 be equivalent to a non-positive least squared linear regression (regularized)? > > Reading the documentation for those parameters in the ?glmnet docs > certainly suggests so, no? > > This is simple enough for you to try yourself, though, so why not just > give it a shot and report back with your results? > > -steve > > -- > Steve Lianoglou > Computational Biologist > Bioinformatics and Computational Biology > Genentech