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: How to use the Wald test when testing for interactions and heterogeneity
From
Amal Khanolkar <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: How to use the Wald test when testing for interactions and heterogeneity
Date
Wed, 18 Sep 2013 13:53:19 +0000
Dear Richard,
Thanks for your reply. It seems to be working fine for the test for heterogeneity however I ran into some problems for the interaction tests:
Maybe the '#' shouldn't be specified when running testparm? I get the error message below 'no such variables'. However it seems to run the second time when I don't specify the # in the testparm command.
. regress syst i.ethnicity_bi2x bwtgestage_sd i.ethnicity_bi2x#c.bwtgestage_sd age byear i.conscript_office if bmi!=. & height_cons!=. & education!=. & multibirth==1 & sex=
> =1, cluster (mor_lopnr)
Linear regression Number of obs = 406833
F( 10,341530) = 1497.67
Prob > F = 0.0000
R-squared = 0.0353
Root MSE = 10.869
(Std. Err. adjusted for 341531 clusters in mor_lopnr)
------------------------------------------------------------------------------------------------
| Robust
syst | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------------------------+----------------------------------------------------------------
ethnicity_bi2x |
2 | -.1666134 .112247 -1.48 0.138 -.3866144 .0533875
3 | -3.942219 .2283697 -17.26 0.000 -4.389816 -3.494621
|
bwtgestage_sd | -.1459854 .0177271 -8.24 0.000 -.18073 -.1112408
|
ethnicity_bi2x#c.bwtgestage_sd |
2 | .3141344 .114124 2.75 0.006 .0904547 .5378141
3 | .4474396 .2303636 1.94 0.052 -.0040664 .8989457
|
age | .4489594 .0384143 11.69 0.000 .3736685 .5242502
byear | .1860315 .0040078 46.42 0.000 .1781763 .1938868
|
conscript_office |
2 | -3.07841 .0497884 -61.83 0.000 -3.175994 -2.980826
3 | 1.991954 .0537103 37.09 0.000 1.886683 2.097224
5 | -2.619412 .0475503 -55.09 0.000 -2.712609 -2.526214
|
_cons | -245.8701 7.978256 -30.82 0.000 -261.5073 -230.233
------------------------------------------------------------------------------------------------
. testparm i.ethnicity_bi2x#bwtgestage_sd
no such variables
r(111);
end of do-file
r(111);
. do "C:\Users\akhan\AppData\Local\Temp\3\STD00000000.tmp"
. regress syst i.ethnicity_bi2x bwtgestage_sd i.ethnicity_bi2x#c.bwtgestage_sd age byear i.conscript_office if bmi!=. & height_cons!=. & education!=. & multibirth==1 & sex=
> =1, cluster (mor_lopnr)
Linear regression Number of obs = 406833
F( 10,341530) = 1497.67
Prob > F = 0.0000
R-squared = 0.0353
Root MSE = 10.869
(Std. Err. adjusted for 341531 clusters in mor_lopnr)
------------------------------------------------------------------------------------------------
| Robust
syst | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------------------------+----------------------------------------------------------------
ethnicity_bi2x |
2 | -.1666134 .112247 -1.48 0.138 -.3866144 .0533875
3 | -3.942219 .2283697 -17.26 0.000 -4.389816 -3.494621
|
bwtgestage_sd | -.1459854 .0177271 -8.24 0.000 -.18073 -.1112408
|
ethnicity_bi2x#c.bwtgestage_sd |
2 | .3141344 .114124 2.75 0.006 .0904547 .5378141
3 | .4474396 .2303636 1.94 0.052 -.0040664 .8989457
|
age | .4489594 .0384143 11.69 0.000 .3736685 .5242502
byear | .1860315 .0040078 46.42 0.000 .1781763 .1938868
|
conscript_office |
2 | -3.07841 .0497884 -61.83 0.000 -3.175994 -2.980826
3 | 1.991954 .0537103 37.09 0.000 1.886683 2.097224
5 | -2.619412 .0475503 -55.09 0.000 -2.712609 -2.526214
|
_cons | -245.8701 7.978256 -30.82 0.000 -261.5073 -230.233
------------------------------------------------------------------------------------------------
.
end of do-file
. do "C:\Users\akhan\AppData\Local\Temp\3\STD00000000.tmp"
. testparm i.ethnicity_bi2x bwtgestage_sd
( 1) 2.ethnicity_bi2x = 0
( 2) 3.ethnicity_bi2x = 0
( 3) bwtgestage_sd = 0
F( 3,341530) = 122.45
Prob > F = 0.0000
The zeros above don't make sense to me.
Thanks,
/Amal.
________________________________________
From: [email protected] [[email protected]] on behalf of Richard Williams [[email protected]]
Sent: 18 September 2013 16:35
To: [email protected]; [email protected]
Subject: Re: st: How to use the Wald test when testing for interactions and heterogeneity
At 07:59 AM 9/18/2013, Amal Khanolkar wrote:
>Hi,
>
>Could anyone tell me the right syntax for using the Wald test for
>the following regression models? I tried looking at the help page
>for the command 'test' but I wasn't able to figure it out:
>
>
>Ideally I would test for heterogeneity for the following model as
>follows using the LRT, but this doesn't go with the cluster option:
>
>regress syst i.ethnicity_bi2x age byear i.conscript_office if bmi!=.
>& height_cons!=. & education2!=. & bwtgestage_sd!=. &
>gestwk_catx2!=. & multibirth==1 & sex==1, cluster (mor_lopnr)
>estimates store a
>regress syst ethnicity_bi2x age byear i.conscript_office if bmi!=. &
>height_cons!=. & education2!=. & bwtgestage_sd!=. & gestwk_catx2!=.
>& multibirth==1 & sex==1, cluster (mor_lopnr)
>lrtest a
So, are you basically trying to test whether ethnicity_bi2x can be
treated as a continuous variable? Does something like this do what you want?
sysuse auto, clear
reg price mpg c.rep78 i.rep78
testparm i.rep78
If the test comes up insignificant (as it does in this case) this
means that the continuous version alone is sufficient.
>And similarly when testing for interactions:
>
>xi: regress syst i.ethnicity_bi2x*bwtgestage_sd age byear
>i.conscript_office bmi height_cons i.education if multibirth==1 &
>sex==1, cluster (mor_lopnr)
>estimates store A
>xi: regress syst i.ethnicity_bi2x bwtgestage_sd age byear
>i.conscript_office bmi height_cons i.education if multibirth==1 &
>sex==1, cluster (mor_lopnr)
>lrtest A
Why the switch to xi? If you have Stata 11 or higher, I think it
should be something like
regress syst i.ethnicity_bi2x bwtgestage_sd
i.ethnicity_bi2x#c.bwtgestage_sd age byear i.conscript_office bmi
height_cons i.education if multibirth==1 & sex==1, cluster (mor_lopnr)
testparm i.ethnicity_bi2x#bwtgestage_sd
You may also wish to see this thread from 2 years ago:
http://www.stata.com/statalist/archive/2011-10/msg01350.html
http://www.stata.com/statalist/archive/2011-10/msg01352.html
http://www.stata.com/statalist/archive/2011-10/msg01389.html
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/