I have a data set in which counts were collected at 2 time points under 2
conditions for each subject. There are no missing data. Data for one
subject look like this:
id time condit~n diagno~s count
5 0 0 2 0
5 0 1 2 8
5 1 0 2 5
5 1 1 2 7
Question 1.
I fitted a fixed effects negative binomial model including time, condition,
and their interaction:
. xi: xtnbreg count i.time*condition, i(id) fe irr nolog
i.time _Itime_0-1 (naturally coded; _Itime_0 omitted)
i.time*condit~n _ItimXcondi_# (coded as above)
Conditional FE negative binomial regression Number of obs = 544
Group variable (i): id Number of groups = 136
Obs per group: min = 4
avg = 4.0
max = 4
Wald chi2(3) = 154.25
Log likelihood = -646.33027 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
count | IRR Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Itime_1 | 2.069823 .1629906 9.24 0.000 1.773798 2.415249
condition | 1.201935 .1071924 2.06 0.039 1.009179 1.431508
_ItimXcond~1 | .3432684 .0418947 -8.76 0.000 .2702388 .4360336
------------------------------------------------------------------------------