Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Constraining OLS coefficients so that prediction satisfies a particular condition


From   "Feiveson, Alan H. (JSC-SK311)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: Constraining OLS coefficients so that prediction satisfies a particular condition
Date   Fri, 20 May 2011 11:03:45 -0500

Amer - 

You can constrain the prediction to be a particular value for  a limited number of values of x ( in general the same as the number of x's), but no more. This is because the prediction model is


y_hat = b0 + b1*x1 + b2*x2


So (for example) if you want y_hat to equal 10 for x1 = 3 and x2=6, the constraint would be 

b0 + 3*b1 + 6*b2 = 10

In addition, suppose you want y_hat to equal 5 for x1 = 5 and x2=13. Then a second constraint would be

b0 + 5*b1 + 13*b2 = 5

If you add a third constraint, assuming the three constraints are linearly independent, the b's would be completely determined so there would be no need to do the regression.


If you have more than three (linearly independent) constraints (as you suggest), it would be impossible to satisfy them all.


Furthermore, if the right hand side of your constraints involve the dependent variable, the assumed OLS error model would not apply and any inference you make would be suspect.

Al Feiveson


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Maarten Buis
Sent: Friday, May 20, 2011 8:45 AM
To: [email protected]
Subject: Re: st: Constraining OLS coefficients so that prediction satisfies a particular condition

On Fri, May 20, 2011 at 2:21 PM, Amer Hasan <[email protected]> wrote:
> I would like to perform the following calculation using Stata 10.1SE
> on a windows xp machine.
>
> reg y1 x1 x2 if year==1
>
> predict y2-hat if year==2, xb
>
> such that y1 - y2-hat = K
>
> y1 - is observed
>
> y2-hat - is the prediction using betas of year 1 and Xs of year 2.
>
> K is the observed difference between y1 and y2 (also observable).
>
> I know I can constrain the betas and that should change the
> prediction. What I am not sure about is how to do so in such a way
> that the prediction satisfies the condition. Any guidance on how to
> start would be much appreciated. I may also not be seeing the forest
> for the trees.

I don't think you can do this with -constraints-, so you'll probably
have to write your own -ml- problem for this (if you were using Stata
11 I would say that -gmm- would fit nicer with the way you talk about
this problem.)

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index