[R] Linear Models with positive coefficients?

John Logsdon j.logsdon at lancaster.ac.uk
Thu Jul 8 12:15:03 CEST 1999



On Thu, 8 Jul 1999, Bill Simpson wrote:

> I don't think nnls.fit is available in R.
> 
> 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)
> 
> Bill
> 

I have used nlm with constraints imposed by minimising

-loglik+scale*(alpha^4)I(alpha<0)

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.

John

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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