Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Feiveson, Alan H. (JSC-SK311)" <alan.h.feiveson@nasa.gov> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten Buis Sent: Friday, May 20, 2011 8:45 AM To: statalist@hsphsun2.harvard.edu Subject: Re: st: Constraining OLS coefficients so that prediction satisfies a particular condition On Fri, May 20, 2011 at 2:21 PM, Amer Hasan <amerhasan1@gmail.com> 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/

**References**:**st: Constraining OLS coefficients so that prediction satisfies a particular condition***From:*Amer Hasan <amerhasan1@gmail.com>

**Re: st: Constraining OLS coefficients so that prediction satisfies a particular condition***From:*Maarten Buis <maartenlbuis@gmail.com>

- Prev by Date:
**st: RE: RE: allpossible & xtmixed** - Next by Date:
**st: ivreg2 & diagnostic statistics** - Previous by thread:
**Re: st: Constraining OLS coefficients so that prediction satisfies a particular condition** - Next by thread:
**st: Re: Constraining OLS coefficients so that prediction satisfies a particular condition** - Index(es):