[R] Constrained coefficients in lm

From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>
Date: Wed, 23 Jul 2008 15:35:55 -0400


Dear list,

I have a data set which looks like myDF (see below) and I'd like to estimate the linear model rea=a*rea+b*mod+error, where a+b=1 and a,b>0. I tried

mymodel=lm(rea~ st + mod-1, data=myDF)
summary(mymodel)

but I couldn't get what I'm looking for. Also, I tried RSiteSearch("constrained coefficients in lm") which produces 20 hints, but they're not what I need.

Any help would be appreciated.

Thanks in advance,

Jorge

# Data set to estimate the model
myDF=read.table(textConnection("rea st mod  14482734 14305907 14761000
 14427969 14502228 14848024
 14698723 14408264 14259492
 15741064 14797138 14565303
 15914249 16162714 14348592
 16475594 15977623 15592229
 17124613 16688456 14988151
 17575281 17383822 15647240
 17721548 17757635 15624907

 18178273 17779858 15598802
 18005810 18364233 16363321
 18032618 17938963 16536844
 17737470 18043063 17096089
 17652014 17624039 17056355"),header=TRUE,sep="") closeAllConnections()

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 23 Jul 2008 - 20:04:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Jul 2008 - 20:34:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive