[R] Logistic regression with coef>0 (summary of previous answers)

ROS Mathieu mim78 at cict.fr
Mon Aug 2 14:13:52 CEST 1999

On Mon, 26 Jul 1999, Christian Posse wrote:

> Hi,
> recently I saw but did not pay too much attention to a question
> that concerned regression with positive coefficients. In Splus,
> thereis the nnls() function that can be used if I am not wrong,
> but what about R ?
> Now I have the same problem: doing a logistic regression under
> constraint that coefs are non negative. What can I do with R?
> is there a (weighted) nnls() counterpart available?
> Thanks for any help!
> Christian

there is nothing like nnls() under R but you can try doing the job with   
nlm() (???).
I 'summarize' the few mail about this topic below.
hope this will help you,

 Bill Simpson :
"I would guess the way to do it would be to use a nonlinear optimizer that
allows constraints on the search space. R has a nonlinear optimizer called
nlm, but it does an unconstrained search. (nlm is just a standard routine
from netlib I think that is glued onto R. It would be nice to have a
nonlin optimizer with constraints, and several exist at netlib and
elsewhere; perhaps someone with the need for it and the knowledge of how
to do it will glue one onto R)"

John Logsdon :
"I have used nlm with constraints imposed by minimising


where alpha bears some relation to the parameter(s) of interest, the
(positive) scale is chosen to ensure sensible dominance whenever alpha
strays into the negative regime and the indicator function ensures that it
operates only where alpha<0.  The properties of the log-likelihood were
not of immediate interest ... It worked pretty well to ensure a negative
intercept (in this case) but then I realised that only a few cases were
leading to the problem and some further thought and a better analysis
meant that I could approach the problem in a different way.

Just a thought.  Otherwise a constrained optimisation algorithm, which is
not available in R.  Or parameterise so that the log of the parameter is
used, as in the gnlr suite for the shape parameter."

Douglas Bates:
"There are simpler ways of going about the task because it is
essentially an integer programming problem.  You are just searching
for the subset of the coefficients that should be set equal to zero.

Dennis Wolf and I wrote about it several years ago including some
Fortran code.

    Author = {Bates, Douglas M. and Wolf, Dennis A.},
    Title = {Non-negative Regression By {G}ivens Rotations},
    Year = 1984,
    Journal = {Communications in Statistics, Part B -- Simulation and
    Volume = 13,
    Pages = {841--850}

Mathieu Ros
mathieuros at bigfoot.com
(Universite Paul Sabatier, Toulouse)
Universite Joseph Fourier, Grenoble

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list