Hello everyone,
I have a panel dataset in which my panels are classrooms and the time component are weeks. I am interested to see if the proportion of adolescent (main IV) influences the number of fights in classrooms (DV). I am also including the total of number students in the classroom as a covariate. My data is unbalanced.
Since I am interested in analysis the impact of a variable that vary over time and want to control for between panel variations, I decided to use Fixed Effects (FE) models. After running my model, I run margins and marginsplot commands to see the predicted counts. The predicted values looked inflated to me. I rerun the model using RE to compare predicted values and observed a big differences in in the predicted values as well as in the CI. After doing some reading, I learned that FE models tend to have greater standard errors than RE models specially when there is little variation between subjects compared to within subject variation. This is the case in my data (see below). However, the coefficients from the two models are close.
Marvin
I have a panel dataset in which my panels are classrooms and the time component are weeks. I am interested to see if the proportion of adolescent (main IV) influences the number of fights in classrooms (DV). I am also including the total of number students in the classroom as a covariate. My data is unbalanced.
Since I am interested in analysis the impact of a variable that vary over time and want to control for between panel variations, I decided to use Fixed Effects (FE) models. After running my model, I run margins and marginsplot commands to see the predicted counts. The predicted values looked inflated to me. I rerun the model using RE to compare predicted values and observed a big differences in in the predicted values as well as in the CI. After doing some reading, I learned that FE models tend to have greater standard errors than RE models specially when there is little variation between subjects compared to within subject variation. This is the case in my data (see below). However, the coefficients from the two models are close.
- Why I am seeing considerable big difference in the predicted incident counts (although the coefficients are very similar between FE and RE)?
- How can we test which model is given better predictions? Residuals?
- Which model is more ideal?
- Is there an easy way to run a Hausman test for count data to see which model to use?
- I know that overtime the number of fights has increased, is this affecting the model? Should I include time as a covariate in the model?
Marvin
Code:
xtnbreg WeekFight AgeYAp All, fe irr
Conditional FE negative binomial regression Number of obs = 4,133
Group variable: ha Number of groups = 141
Obs per group:
min = 2
avg = 29.3
max = 52
Wald chi2(2) = 8.89
Log likelihood = -1630.2392 Prob > chi2 = 0.0118
------------------------------------------------------------------------------
WeekFight | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
AgeYAp | 1.011179 .0039194 2.87 0.004 1.003526 1.01889
All | 1.005263 .0080922 0.65 0.514 .9895268 1.021249
_cons | 1.525927 .7998618 0.81 0.420 .5461977 4.26302
------------------------------------------------------------------------------
xtnbreg WeekFight AgeYAp All, re irr
Random-effects negative binomial regression Number of obs = 5,043
Group variable: ha Number of groups = 243
Random effects u_i ~ Beta Obs per group:
min = 1
avg = 20.8
max = 52
Wald chi2(2) = 87.28
Log likelihood = -2048.9312 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
WeekFight | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
AgeYAp | 1.012833 .001718 7.52 0.000 1.009472 1.016206
All | .9982385 .0044208 -0.40 0.691 .9896113 1.006941
_cons | 1.614235 .717855 1.08 0.282 .6752036 3.859211
-------------+----------------------------------------------------------------
/ln_r | 3.880139 .4167189 3.063385 4.696893
/ln_s | .9124844 .2173875 .4864128 1.338556
-------------+----------------------------------------------------------------
r | 48.43095 20.18209 21.39987 109.6061
s | 2.490502 .541404 1.626471 3.813533
--------------------------------------------------------------------------
. xtsum AgeYAp
Variable | Mean Std. Dev. Min Max | Observations
-----------------+--------------------------------------------+----------------
AgeYAp overall | 33.01448 42.01591 1 100 | N = 5043
between | 36.16705 1 100 | n = 243
within | 10.04124 -59.38552 121.3693 | T-bar = 20.7531
* Commands to generate predicted values
xtnbreg WeekFight AgeYAp c.All##c.All if hatype==1, irr
margins,at(AgeYAp=(0(10)100)) atmeans vsquish predict(nu0)
marginsplot , noci
xtnbreg WeekFight AgeYAp if hatype==1,fe irr
margins,at(AgeYAp=(0(10)100)) atmeans vsquish predict(nu0)
marginsplot

Comment