What is best way to run OLS in R with linear inequality constraints, e.g. $$y(x)= ax + b,$$ where $0<a<1$?
Asked
Active
Viewed 1,704 times
1
-
1did you get cut off there? – Eric Peterson Jul 19 '13 at 14:19
-
I copied the title of your question into Google. First hit: an article on Inference [with Linear Equality and Inequality Constraints Using R](http://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDgQFjAA&url=http%3A%2F%2Fcran.r-project.org%2Fweb%2Fpackages%2Fic.infer%2Fvignettes%2Fic.infer.pdf&ei=qUzpUfyuC-fP0QXm6YDoCg&usg=AFQjCNH0uUSnQ0QEI0Q8jct8PHAid1TjTg&sig2=p2wTDXPK86cDm0evmtp83A&bvm=bv.49478099,d.d2k&cad=rja) – Stijn Jul 19 '13 at 14:27
-
Good find, @Stijn. That package could be overkill for such a simple problem, though: on any platform it's easy to run OLS and check whether $0\lt a \lt 1$ and, if not, to run and compare the two submodels $y=b$ and $y=x+b$. – whuber Jul 19 '13 at 14:30
-
Wait, is this about _linear_ constraints, or _box_ constraints? – Hong Ooi Jul 19 '13 at 15:09
1 Answers
1
You can use constrOptim
to minimise the RSS, subject to the constraints. There's an example in Modern Applied Statistics with S of using optim to do logistic regression via direct minimisation of the negative log-likelihood; just do the same, but changing the binomial likelihood to sums of squares and adding the constraint.

Hong Ooi
- 7,629
- 3
- 29
- 52