Re: Linear Reg. & coeff>0

Christian Keller (ckeller@aicos.com)
Wed, 28 Jan 1998 10:22:01 +0100


You can use 'nnls.fit' (Linear least-squares fit with
coefficients constrained to be nonnegative).
See help(nnls.fit) for details.

For your example:
> nnls.fit(cbind(X1,X2), y)

Note that (by default) nnls.fit does not estimate an intercept
term (which is what you want).
[ To include an intercept, use: nnls.fit(cbind(1,X1,X2), y) ]

Unfortunately 'nnls.fit' can't handle model formulas and
the output is rather poor (no special print and summary methods).

-- Christian
----------------------------------------------------------
Christian Keller Tel: +41 61 686 98 81
AICOS Technologies AG Fax: +41 61 686 98 88
Efringerstrasse 32 email: ckeller@aicos.com
CH-4057 Basel, Switzerland Web: http://www.aicos.com/
----------------------------------------------------------