Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Maarten Buis <maartenlbuis@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Comparaison of turning points (Inverted U curve) for the same model on different samples |
Date | Mon, 4 Jul 2011 09:15:04 +0200 |
On Sun, Jul 3, 2011 at 10:06 PM, L.M.A. Mulotte wrote: > I have an OLS model that includes both a linear effect and the quadratic term. > > I would like to do a test that compares whether the turning points obtained with two different samples are significantly different. One way to get there is to estimate one model for both samples and include interaction terms between the dummy south and all other explanatory variables. This will get you almost the same model as when you estimate the two models separately. The only difference is that the model with interaction terms assumes that the residual variance is the same across groups (homoscedasticity). If you think that matters you can add the -vce(robust)- option. After estimating the single model with interaction terms you can use -nlcom- to compute the two turning points with their confidence intervals, and use -testnl- to test whether the two turning points are equal. In the example below I use the new factor variable notation to create the interaction terms and the square terms. I think they are convenient for various reasons, but the one disadvantage is that I can never remember how the different parameters are called, which is important for commands like -nlcom- and -testnl-. So I often "replay" the same regression, i.e. type -regress- without any variables, followed by a comma and whatever display options I want, in this case -coeflegend-. This gives me a legend assigning names to the different coefficients. *---------------------- begin example ------------------------ use http://www.stata-press.com/data/r11/nlswork, clear // estimate the model reg ln_wage i.south i.south#(c.age##c.age c.grade c.birth_yr) // see how the coefficients are called reg, coeflegend // turning points: nlcom (north:-_b[0b.south#c.age]/(2*_b[0b.south#c.age#c.age])) /// (south:-_b[1.south#c.age] /(2*_b[1.south#c.age#c.age] )) // test whether turning points are equal: testnl -_b[0b.south#c.age]/(2*_b[0b.south#c.age#c.age]) = /// -_b[1.south#c.age] /(2*_b[1.south#c.age#c.age] ) *----------------------- end example ------------------------- (For more on examples I sent to the Statalist see: http://www.maartenbuis.nl/example_faq ) Hope this helps, Maarten Ps. Notice that in this example the confidence intervals overlap but the test rejects the null-hypothesis that the two turning points are equal. This is not a contradiction, it just shows that checking whether two confidence intervals overlap is not a proper test of the hypothesis that the two estimates are the same (it ignores the covariance between the estimates). A very readable discussion of this issue can be found in: Gellman, A. and H. Stern (2006) "The Difference Between `Significant' and `Not Significant' is not Itself Statistically Significant" The American Statistician, 60(4): 328--331. <http://www.stat.columbia.edu/~gelman/research/published/signif4.pdf> -------------------------- 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/