I am looking for some open source or an existing library I can use. As far as I tell the glmnet package isn’t very easily extensible to cover the non negative case. I may be wrong, Any one with any ideas much appreciated.

By non-negative I mean that all coefficients are constrained to be positive (> 0).

**Answer**

In `glmnet`

there is the option

```
lower.limits=0
```

that you can use and that would be the appropriate way to enforce positivity constraints on the fitted coefficients and if you set parameter `alpha`

to 1 you will be fitting LASSO. In combination with the argument `upper.limits`

you can also specify box constraints. The `glmnet`

package is also much faster than the `penalized`

package, suggested in another answer here.

An `Rcpp`

version of `glmnet`

that can fit the lasso & elastic net with support for positivity and box constraints is also in preparation, and is available for testing at https://github.com/jaredhuling/ordinis

**Attribution***Source : Link , Question Author : gbh. , Answer Author : Tom Wenseleers*