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]
st: handling time-dependent binary covariates
From
David Torres <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: handling time-dependent binary covariates
Date
Tue, 21 Jan 2014 15:57:23 -0500
Statalisters,
When using time-dependent binary covariates, do I need to interact it with the main time-varying predictor? For instance, using panel data in Stata 13.0 I have the following model:
. xtreg smsc outzone i.race i.race#c.year i.race#c.year#c.year female ///
> c_medrent c_medvehic c_medhhinc c_medage c_pctminor civic relig socadv year y0 y1 y5 y6 y7 y8 y9 y10 y11 y12 ///
> c.year#c.year yy0 yy1 yy5 yy6 yy7 yy8 yy9 yy10 yy11 yy12 atrisk#c.year engathome#c.year freered#c.year poverty#c.y
> ear ///
> diffsch##race#c.year, mle
Fitting constant-only model:
Iteration 0: log likelihood = -194472.82
Iteration 1: log likelihood = -174301.04
Iteration 2: log likelihood = -165292.87
Iteration 3: log likelihood = -161963.53
Iteration 4: log likelihood = -161130.04
Iteration 5: log likelihood = -161038.87
Iteration 6: log likelihood = -161037.05
Iteration 7: log likelihood = -161037.05
Fitting full model:
Iteration 0: log likelihood = -140033.01
Iteration 1: log likelihood = -139278.08
Iteration 2: log likelihood = -139164.47
Iteration 3: log likelihood = -139162.35
Iteration 4: log likelihood = -139162.35
Random-effects ML regression Number of obs = 28021
Group variable: short_id Number of groups = 6208
Random effects u_i ~ Gaussian Obs per group: min = 3
avg = 4.5
max = 5
LR chi2(49) = 43749.39
Log likelihood = -139162.35 Prob> chi2 = 0.0000
-------------------------------------------------------------------------------------
smsc | Coef. Std. Err. z P>|z| [95% Conf. Interval]
--------------------+----------------------------------------------------------------
outzone | -3.182192 1.198185 -2.66 0.008 -5.530591 -.8337933
|
race |
2 | -31.20464 2.24258 -13.91 0.000 -35.60001 -26.80926
3 | -28.5403 2.0518 -13.91 0.000 -32.56175 -24.51885
4 | 1.611791 2.923433 0.55 0.581 -4.118032 7.341614
|
race#c.year |
2 | 1.908044 1.873106 1.02 0.308 -1.763176 5.579264
3 | 3.822111 1.684915 2.27 0.023 .5197388 7.124483
4 | 14.18943 2.324376 6.10 0.000 9.633738 18.74512
|
race#c.year#c.year |
2 | -.5056039 .4568824 -1.11 0.268 -1.401077 .3898691
3 | -.5390523 .40972 -1.32 0.188 -1.342089 .263984
4 | -2.998909 .5643888 -5.31 0.000 -4.10509 -1.892727
|
female | 5.715788 1.051852 5.43 0.000 3.654197 7.77738
c_medrent | -.4404543 .9006682 -0.49 0.625 -2.205732 1.324823
c_medvehic | .7142736 .61236 1.17 0.243 -.48593 1.914477
c_medhhinc | 7.453046 1.245926 5.98 0.000 5.011076 9.895016
c_medage | 1.173216 .6061769 1.94 0.053 -.0148694 2.3613
c_pctminor | 5.684921 .7256604 7.83 0.000 4.262652 7.107189
civic | -2.894772 .5915157 -4.89 0.000 -4.054122 -1.735423
relig | .9835531 .2629566 3.74 0.000 .4681675 1.498939
socadv | 3.693462 .9997456 3.69 0.000 1.733997 5.652927
year | 59.56641 1.597068 37.30 0.000 56.43621 62.6966
y0 | .0643465 1.27252 0.05 0.960 -2.429747 2.558441
y1 | -3.372546 .8292015 -4.07 0.000 -4.997751 -1.747341
y5 | .1591324 .8277091 0.19 0.848 -1.463148 1.781412
y6 | .1822894 .5812737 0.31 0.754 -.9569861 1.321565
y7 | -4.428043 1.142157 -3.88 0.000 -6.666629 -2.189457
y8 | .9319361 .5928273 1.57 0.116 -.229984 2.093856
y9 | -3.927906 .6685466 -5.88 0.000 -5.238233 -2.617579
y10 | 2.441781 .5483947 4.45 0.000 1.366947 3.516615
y11 | -.6370202 .2528959 -2.52 0.012 -1.132687 -.1413534
y12 | -2.471176 .964931 -2.56 0.010 -4.362406 -.5799457
|
c.year#c.year | -3.013671 .3810381 -7.91 0.000 -3.760492 -2.26685
|
yy0 | .4466371 .3150176 1.42 0.156 -.1707861 1.06406
yy1 | .8907846 .2044653 4.36 0.000 .49004 1.291529
yy5 | .1525929 .2021901 0.75 0.450 -.2436924 .5488781
yy6 | -.0119037 .14286 -0.08 0.934 -.2919041 .2680968
yy7 | .8696996 .2790646 3.12 0.002 .322743 1.416656
yy8 | -.3730329 .1463984 -2.55 0.011 -.6599684 -.0860974
yy9 | .6080207 .1641248 3.70 0.000 .286342 .9296994
yy10 | -.4751123 .1334052 -3.56 0.000 -.7365818 -.2136429
yy11 | .0575101 .0618211 0.93 0.352 -.063657 .1786772
yy12 | .3782496 .2361089 1.60 0.109 -.0845153 .8410146
|
atrisk#c.year |
1 | -5.772128 .2116457 -27.27 0.000 -6.186946 -5.35731
|
engathome#c.year |
1 | -3.864273 .3262961 -11.84 0.000 -4.503802 -3.224744
|
freered#c.year |
1 | -.8733209 .2938359 -2.97 0.003 -1.449229 -.2974131
|
poverty#c.year |
1 | -1.480123 .3160498 -4.68 0.000 -2.099569 -.8606767
|
diffsch#c.year |
1 | 1.796285 .6756651 2.66 0.008 .4720062 3.120565
|
diffsch#race#c.year |
1 2 | .4638015 .8026695 0.58 0.563 -1.109402 2.037005
1 3 | -.8125528 .7936596 -1.02 0.306 -2.368097 .7429914
1 4 | -.0041942 1.2702 -0.00 0.997 -2.49374 2.485351
|
_cons | 504.739 1.893013 266.63 0.000 501.0288 508.4492
--------------------+----------------------------------------------------------------
/sigma_u | 31.61099 .3475836 30.93703 32.29964
/sigma_e | 28.16893 .1360864 27.90347 28.43692
rho | .5573886 .0061658 .5452791 .5694448
-------------------------------------------------------------------------------------
Likelihood-ratio test of sigma_u=0: chibar2(01)= 9414.31 Prob>=chibar2 = 0.000
My binary time-dependent variables are atrisk, engathome, freered, poverty, and diffsch. I've interacted the first four with year, my time-varying predictor. Diffsch is interacted with year to calculate the per year gains to out-of-zone attendance, but I also interact this with race to produce a cross-level interaction between race and yearly gains due to out-of-zone attendance. Do I have this correct?
Thanks,
Diego
*
* 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/