While lm() is a linear modeling, the constraints make it easier to solve with a nonlinear tool. Both my packages Rvmmin and Rcgmin (I recommend the R-forge versions as more up-to-date) have bounds constraints and "masks" i.e., fixed parameters. I am actually looking for example problems of this type that are more recent than the ones that got me into this 30 years ago. Do contact me off-list if you have something that could be shared. I'd also welcome discussion on appropriate tools for such constrained linear modeling problems. They are, I believe, more or less present in most linear modeling situations, but we rarely impose the constraints explicitly, and tend to use lm() and (hopefully) check if the solution obeys the conditions. Best, John Nash On 06/25/2012 06:00 AM, r-help-request at r-project.org wrote:> Message: 5 > Date: Sun, 24 Jun 2012 03:34:10 -0700 (PDT) > From: rgoodman <rosa.goodman at gmail.com> > To: r-help at r-project.org > Subject: Re: [R] Constrained coefficients in lm (correction) > Message-ID: <1340534050627-4634321.post at n4.nabble.com> > Content-Type: text/plain; charset=us-ascii > > Hi Jorge, > > Did you ever figure this out? I want to do the same thing with the > additional constraint of the coef for x1 = 2. > > lm(Y~offset(2*x1)+x2+x3,data=mydata) > where b= coeff for x2, c = coeff for x3, b+c=1 and b and c>0. > > I've loaded the systemfit package, but the suggestion "R*beta0 = q, where R > is R.restr and q is q.restr in the function call" makes no sense to me. > > Cheers, > Rosie