Dear StataList users,
Let's say that I’m evaluating the effectiveness of a program that aims to reduce the number of students’ interruptions in a classroom. The program has 4 levels. The time subjects stay in the program’s levels differ from one another (not fixed time interval). My strategy is to compare counts of interruptions before and while being in the program using xtnbreg with the exposure option to control for the different time interval (days in the program).
1. Is my modeling technique/strategy valid?
2. I do not want to compare only pre vs all the program levels but also interruptions between levels. I did this manually using the test post command. Is there a way to compute all the combination (permutations) at once? Perhaps using margins?
3. How can I interpret the results taking into account the exposure option? My attempt- We estimate that level 1 interruption rate is 1.29 (1/.7764) times larger than pre program rates.
4. After running the regression I run the margin command. How can I interpret the results of the margin command? Are these the predicted average interruptions per day? Can I say on average, subjects in level 2 had 3.022 interruptions per day which is -.253 fewer questions than pre levels? or these are interruptions during all days in the program?
Thank you!
Let's say that I’m evaluating the effectiveness of a program that aims to reduce the number of students’ interruptions in a classroom. The program has 4 levels. The time subjects stay in the program’s levels differ from one another (not fixed time interval). My strategy is to compare counts of interruptions before and while being in the program using xtnbreg with the exposure option to control for the different time interval (days in the program).
1. Is my modeling technique/strategy valid?
Code:
. xtnbreg event i.time, fe irr exposure(days) note: 3 groups (3 obs) dropped because of only one obs per group note: 319 groups (676 obs) dropped because of all zero outcomes Iteration 0: log likelihood = -730.20997 Iteration 1: log likelihood = -683.11873 Iteration 2: log likelihood = -676.40059 Iteration 3: log likelihood = -675.1029 Iteration 4: log likelihood = -674.9261 Iteration 5: log likelihood = -674.91054 Iteration 6: log likelihood = -674.91035 Iteration 7: log likelihood = -674.91035 Conditional FE negative binomial regression Number of obs = 1,409 Group variable: BOOKCASENUMBER Number of groups = 564 Obs per group: min = 2 avg = 2.5 max = 5 Wald chi2(4) = 13.99 Log likelihood = -674.91035 Prob > chi2 = 0.0073 ------------------------------------------------------------------------------ event | IRR Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- time | 1 | .921984 .0767269 -0.98 0.329 .7832258 1.085325 2 | .7764469 .0750522 -2.62 0.009 .6424416 .9384039 3 | .8872854 .0842731 -1.26 0.208 .7365758 1.068831 4 | .4831852 .1423992 -2.47 0.014 .2711793 .8609355 | _cons | .3672584 .6315017 -0.58 0.560 .0126278 10.68108 ln(days) | 1 (exposure) ------------------------------------------------------------------------------ Note: _cons estimates baseline incidence rate (conditional on zero random effects). . end of do-file
Code:
test 1.time == 2.time test 1.time == 3.time test 1.time == 4.time test 2.time == 3.time test 2.time == 4.time test 3.time == 4.time
4. After running the regression I run the margin command. How can I interpret the results of the margin command? Are these the predicted average interruptions per day? Can I say on average, subjects in level 2 had 3.022 interruptions per day which is -.253 fewer questions than pre levels? or these are interruptions during all days in the program?
Code:
. margins time Adjusted predictions Number of obs = 1,409 Model VCE : OIM Expression : Linear prediction, predict() ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- time | 0 | 3.275641 1.719503 1.90 0.057 -.094522 6.645804 1 | 3.194414 1.725336 1.85 0.064 -.1871829 6.576011 2 | 3.022614 1.73579 1.74 0.082 -.3794707 6.424699 3 | 3.156053 1.719668 1.84 0.066 -.2144342 6.526539 4 | 2.548286 1.742859 1.46 0.144 -.8676556 5.964227 ------------------------------------------------------------------------------ . margins, dydx(time) atmeans Conditional marginal effects Number of obs = 1,409 Model VCE : OIM Expression : Linear prediction, predict() dy/dx w.r.t. : 1.time 2.time 3.time 4.time at : 0.time = .4002839 (mean) 1.time = .259049 (mean) 2.time = .1320085 (mean) 3.time = .1433641 (mean) 4.time = .0652945 (mean) ------------------------------------------------------------------------------ | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- time | 1 | -.0812274 .0832193 -0.98 0.329 -.2443343 .0818796 2 | -.253027 .0966611 -2.62 0.009 -.4424793 -.0635748 3 | -.1195886 .0949785 -1.26 0.208 -.3057431 .0665659 4 | -.7273553 .2947093 -2.47 0.014 -1.304975 -.1497356 ------------------------------------------------------------------------------ Note: dy/dx for factor levels is the discrete change from the base level. . end of do-file
- Finally my predicted values seemed a little to high. I am predicting the total number of interruptions among all days the subject was in the program? Or interruption per day? Why is the predicted counts too high? Perhaps because fixed effect drops panels with 0 outcomes? Or is it because I am not including significant predictors in my model? Other thoughts?
Code:
. listsome id time event p, sepby(id) . predict p if e(sample) (option xb assumed; linear prediction) (679 missing values generated) . listsome ID time event p, sepby(ID) +-------------------------------+ | ID time event p | |-------------------------------| 1. | 1 0 1 -.3085425 | 2. | 1 2 0 .6911934 | |-------------------------------| 3. | 2 0 1 3.172698 | 4. | 2 1 0 2.528001 | |-------------------------------| 5. | 3 0 0 . | 6. | 3 1 0 . | |-------------------------------|
Comment