5

I am trying to use LASSO for model selection, but I need my fitted values to remain non-negative. Is there a way to implement this simply in R? I've found that the penalized package allows for non negative coefficients, but not so for non negative fits.

user603
  • 21,225
  • 3
  • 71
  • 135
Concofused
  • 51
  • 1
  • 2
    You can fit a model that can't fit negative values easily enough - GLMs and nonlinear least squares each give ways to do that, but if that's the case, you almost certainly have heterskedasticity and nonlinear relationships between y and x (or else the non-negativity generally won't hold). Depending on what your response consists of (and what you understand about it), one or the other choice may be better; usually I lean toward glms first, as making it easier to model heteroskedasticity and non-negativity. I think there may be some lasso-for-GLMs in R. – Glen_b Oct 24 '14 at 04:23
  • See [here](http://stats.stackexchange.com/questions/109708/two-simple-questions-regarding-glm/109782#109782) for an example where a gamma glm gave a positive fit for all data values (though, being linear, it was necessarily not positive everywhere outside the data). Note that it doesn't assume constant variance. – Glen_b Oct 24 '14 at 04:32
  • Mathematically, it is possible and very easy because adding linear constraints to a convex optimization problem preserves convexity. We don t really have flexible, free, QP solver in R. But we have good, free, LP solvers: if [LAD-LASSO](http://web.hku.hk/~gdli/papers/2007JBES_%20LAD_Lasso.pdf) can solve your problem, then add this info to your question because it is easy to do modify LAD-LASSO in R to make it do what you want. – user603 Oct 24 '14 at 10:19

1 Answers1

1

No, that would make it another optimization problem, which the algorithm does not seem to provide. Remember the Lasso requires a numerical algorithm for computing the solution and the Ridge has a closed form. That package provides you with a numerical method to compute both types of penalties which is great, but you are asking it to solve a different type of optimization problem which is not supported.

kolonel
  • 332
  • 3
  • 10