# Re: st: re: constraints

 From Richard Williams To statalist@hsphsun2.harvard.edu Subject Re: st: re: constraints Date Wed, 29 Jun 2005 02:02:42 -0500

```At 07:39 AM 6/29/2005 +0100, Vidya Mahambare wrote:
```
Following Kit's suggestion I redefined the constraint L.wpi+L2.wpi+L3.wpi=1 as
b(L3) = 1-b(L)-b(L2), and regressed
(wpi - L.wpi) on (L.wpi-L3.wpi), (L2.wpi-L3.wpi) and other variables.

This does not produce a correct R^2, as Richard suspected. It is much lower
because of variables transformations, I think. Is there a way to to calculate a
correct R^2 after using -reg- for this problem?

Thanks,
Vidya
There is still the original suggestion from the FAQ - basically run cnsreg, compute the predicted values, and correlate them with the observed values. That seems like the simplest approach, unless there is a problem I am overlooking.

In addition, as I just noted in another thread, in Stata 9 the -nl- command provides a pretty good alternative to -cnsreg-. Not only is there less typing, you get R^2 as part of the output. The -nl- command was rewritten in Stata 9 and I believe you said you were using 8, so I don't know whether or if you can do this. Anyway, a simple Stata 9 example is

. sysuse auto
. nl (mpg = {b0} + {b1}*price + {b1}*weight + {b1}*displacement)

Whether you can adapt this to Stata 8, or whether you'll still run into the same issue of needing to transform the LHS, I don't know. I'd probably just go with the FAQ unless there is a problem with it in this case. Or, if you are going to be doing zillions of things like this, maybe it is worth your while to figure out how to get -nl- to do this efficiently.

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/