You are on page 1of 2

How can I add minimum and maximum constraints to a

coefficient in a regression in R?
stats.stackexchange.com/questions/282949/how-can-i-add-minimum-and-maximum-constraints-to-a-coefficient-in-a-
regression-i

David 3111 bronze badge

Ask Question
Asked 6 years, 5 months ago

Modified 3 years ago


Viewed 909 times

I have an array (YY) with a series of data to which I must fit the sum of some other arrays
(X1,X2,X3)(X1,X2,X3). The expression is:

Y=c1∗X1+c2∗X2+c3∗X3+eY=c1∗X1+c2∗X2+c3∗X3+e

I need to add some constraints (min and max values of c1c1).

rregressionconstraint
1

This is an extremely bad idea, you will not estimate any quantity of interest. Your
inference will be wrong, your estimates will be biased, and the predictions will be off the
charts – Repmat Jun 1, 2017 at 16:46

Add a comment

1 Answer

If you just want to fit a least squares hyperplane with a constraint in one parameter, what I
would do is:

Fit regression plane as usual.


If c1c1 meets the constraints, you are done.
If c1c1 is outside the constraints, take c1c1 as the maximum or minimum constraint -
whichever is closer to the fitted value. From this moment, c1c1 is a constant and not a
parameter to be estimated.

1/2
Now do the following regression analysis:

Y−c1∗X1=c2∗X2+c3∗X3+e
Y−c1∗X1=c2∗X2+c3∗X3+e

That is, now your response is Y−c1∗X1Y−c1∗X1 (an array of known values) and your
predictors are X2X2 and X3X3.

Please notice that, although this least squares fitting may work, constraints may have effects
on procedure and interpretation of significance tests or variable selection.

edited Nov 22, 2020 at 10:02

answered Jun 1, 2017 at 13:25

Pere
6,22311 gold badge1616 silver badges3232 bronze badges

2/2

You might also like