[R] least squares regression using (inequality) restrictions
Simon Wood
simon at stats.gla.ac.uk
Fri Sep 26 12:51:12 CEST 2003
> I would like to make a lesast squares regression similar to that what
is
> done by the command "lm". But additionally, I would like to impose some
> restrictions:
> 1) The sum of all regression coefficients should be equal to 1.
> 2) Each coefficient should assume a value between 0 and 1. (inequality
> restrictions)
>
> Which command is the best to use in order to solve this problem in a
> computationally efficient way?
- I don't know if it's the best way, but pcls() in package mgcv will do
this for you. It solves penalized least squares problems subject to linear
equality and inequality constraints by quadratic programming (uses a
least squares specific method rather than a general QP method). It's
less easy to use than lm, but not too bad --- see the first example in
?pcls.
Simon
_____________________________________________________________________
> Simon Wood simon at stats.gla.ac.uk www.stats.gla.ac.uk/~simon/
>> Department of Statistics, University of Glasgow, Glasgow, G12 8QQ
>>> Direct telephone: (0)141 330 4530 Fax: (0)141 330 4814
More information about the R-help
mailing list