[R] Non-negativity constraints for logistic regression

tw at netstorm.be tw at netstorm.be
Wed Dec 21 22:59:19 CET 2011

> Dear R users,
> I am currently attempting to fit logistic regression models in R, where
> the slopes should be restricted to positive values. Although I am aware
>> I guess non-negative, as in the subject line, so there actually is a

Indeed, I meant non-negative, zero slopes are also possible parameter
values for my case.

> of the package nnls (which does the trick for linear regression models),
> I did not find any solution for logistic regression. If there is any
> package available for this purpose, I would be interested to know them.
> Alternatively, I realize it is possible to optimize a specialized
> likelihood function that does the trick. Although I know how to optimize
> the log-likelihood of logistic regression models, I am not sure how to
> implement non-negativity constraints for slope parameters without
> messing up the Newton optimization. Therefore, I am also interested in
> solutions for this problem.

>> There is an example of this in the 'Optimization' chapter of MASS (the
book, page 445 to be precise).  You simply use an optimizer with box
constraints: see ?optim and ?nlminb, for example.

Thanks a lot, I managed to get it fully working by passing the constraints
to L-BFGS-B.

More information about the R-help mailing list