Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: robust and test


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: robust and test
Date   Wed, 11 Apr 2007 16:01:02 -0400

Jamie Fagg --
First note that
xi: logistic depvar i.x1 i.x2 i.x1*i.x2, robust cluster(i)
is the same as
xi: logistic depvar i.x1*i.x2, robust cluster(i)
and you can test the joint significance of interactions with
testparm _Ix1X*

That said, the -xi- command is a convenience command that is often
more of an annoyance.  If you ask -xi- to make a bunch of indicator
variables for you, then you have to figure out what those variables
will be called so you can -test- subsets of them.  Much easier in the
long run to learn to make the indicator variables for yourself.  If x1
and x2 each have a lot of categories, this can be tedious until you
learn how to use -levelsof- and -foreach-, at which point it is
trivial.  Also note that since you have several sets of variables that
sum to one, some will need to be dropped, and it may matter which are
included in the model for the outcome of the test.

A cheap illustration:

webuse nlswork, clear
qui xi: logistic coll i.occ*i.race
testparm _IoccX*
foreach i of local o {
qui g byte o_`i'=(occ==`i') if !mi(occ)
foreach j of local r {
 qui g byte o_`i'r_`j'=(occ==`i' & race==`j') if !mi(race,occ)
}
}
foreach j of local r {
qui g byte  r_`j'=(race==`j') if !mi(race)
}
qui logistic coll o_* r_*
testparm o_*r_*
drop o_1 r_1
qui logistic coll o_* r_*
testparm o_*r_*


On 4/11/07, Jamie Fagg <[email protected]> wrote:
I want to compare two models:
xi: logistic depvar i.x1 i.x2, robust cluster(i)
xi: logistic depvar i.x1 i.x2 i.x1*i.x2, robust cluster(i)

I gather from the list and manuals that I can't use lrtest to compare
these models and that I should consider -test-. My first question is
therefore, can -test- compare the fit of two models like this, in the
way that lrtest can for models with no robust option specified.

If so, my second question relates to the syntax because the manuals seem
to suggest that there are 4 different ways of writing the syntax and I
can't decipher which is appropriate to carry out the operation as
described above. If this has been covered in the list already (I'm
afraid I couldn't find it if it has) could someone refer me to the note
in question. And if it hasn't, any help would be much appreciated.
*
*   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/



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