Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: re: constraints

From   "Vidya Mahambare" <[email protected]>
To   <[email protected]>
Subject   Re: st: re: constraints
Date   Wed, 29 Jun 2005 08:27:03 +0100

Yes, I agree - have tried out the method suggested in the FAQ to work out R^2
and it seems to work well.  Don't have access to Stata9 to try out -nl- and so
its easier to stick with the FAQ method than to work out -nl- correctly in


>>> [email protected] 06/29/05 8:02 AM >>>
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?

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:  [email protected]
WWW (personal):
WWW (department):

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index