Re: Linear Reg. & coeff>0

kjetil halvorsen (kjetil@caoba.entelnet.bo)
Wed, 28 Jan 1998 16:01:35 -0600


One possibility is to search on ``optimization'' in the online help,
which gives:

> x <- -7:7
> y <- -0.5*x + rnorm(15)
> m.nnls <- nnls.fit(x,y)
> m.nnls
$coefficients:
[1] 0

$residuals:
[1] 4.28066497 2.76578229 -0.50474952 1.70733572 -0.04350552
0.72081580 0.95465429
[8] 0.25621560 -0.44308532 -1.32724151 -0.89296386 -3.88620392
-1.87771075 -2.20507789
[15] -3.03227638

$dual:
[1] -118.2969

$rkappa:
final minimum
1.797693e+308 1.797693e+308

$call:
nnls.fit(x = x, y = y)

Kjetil.

Tsung-Hsin Lin wrote:
>
> Dear S+ users:
>
> I'd like to ask how to fit a linear regression model
>
> with the constraint that for all coeff>0 and no intercept term
>
> at the same time?
>
> In my understanding till now,
>
> a1<-lm(y~X1+X2-1)
>
> But how can I confirm that coeff>0 definitely?
>
> Thanks for your help!