Statalist


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

Re: st: Test the equality of regression coefficients


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Test the equality of regression coefficients
Date   Wed, 4 Jul 2007 13:43:51 -0400

Simon--
It seems you are getting stuck on the first step of declaring your
data to be panel data, and may have missed this FAQ:
http://www.stata.com/support/faqs/data/repeatedtime.html

You might need to do something like this:
egen tid=group(id trial)
bys tid: gen obs=_n
tsset tid obs
to declare your data as panel data.

However, it is not clear you have panel data per se--you seem to be
estimating a choice model, so you may need a member of the -xtlogit,
fe- family, e.g.
http://www.stata.com/help.cgi?clogit
http://www.stata.com/help.cgi?asclogit
(note that -xtlogit, fe- and -clogit- are the same thing).  You don't
need to -tsset- your data for these commands. Try out
webuse union, clear
tsset
xtlogit union age grade not_smsa south southXt, fe i(id)
clogit union age grade not_smsa south southXt, group(id)
to see my point.

You should probably skip -xi- and -xi3- and make your own indicator
variables (AKA dummy variables) and interactions, which gives you more
control over which indicator variables are excluded to avoid perfect
collinearity.

As for comparing across models, there are at least two ways to go,
illustrated below for the OLS case:

sysuse auto, clear
reg pr mpg if for==1
est sto f1
reg pr mpg if for==0
est sto f0
suest f0 f1
test [f0_mean]mpg=[f1_mean]mpg
g formpg=fore*mpg
reg pr mpg fore form
test form

Note that these approaches differ slightly, as the -suest- approach
does not constrain the variance of the residual to be the same across
subsamples.

Here's an example with -clogit- (AKA -xtlogit, fe-):

webuse union, clear
clogit union age not_smsa t0 south southXt, group(id)
test southXt
g sXage=south*age
g sXnot=south*not_smsa
clogit union age sXage not_smsa sXnot t0 south southXt, group(id)
test southXt
clogit union age not_smsa t0 if south==1, group(id)
est sto s1
clogit union age not_smsa t0  if south==0, group(id)
est sto s0
suest s0 s1
test [s0_union]t0=[s1_union]t0


On 7/4/07, Simon Moore <simoncmoore@gmail.com> wrote:
I'm trying to test the test the equality of regression coefficients for
two models. [I] run something like
tsset id trial
xi3: xtlogit choice i.condition*i.group*var1 var2, i(id) nolog re
But of course, I get
tsset id trial
repeated time values within panel
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index