Hi there, I am relatively new to STATA, and trying to learn to use it to analyze some of my longitudinal count data (Poisson distributed outcome, autoregressive covariance structure, some overdispersion).
Part 1 of my question has to do with how to write STATA code for the random effects and interaction term. For my model, based on previous analysis with another program (SAS), I know I have a significant random effect for the intercept, time (time0), and var2. This is as far as I have gotten creating the code, which does not yet include the random effect of time0 or var2 (I used the STATAMULTILEVEL MIXED EFFECTS REFERENC EMANUAL RELEASE 13):
-where DV = my dependent variable (a count), time0 = day (day 1 to 13), var1 = level-1 predictor (continuous), var2 = level-1 predictor (continuous), var3 = level-2 predictor (continuous)
In addition, I believe there is a var1 x var2 interaction (level-1 interaction), but if I input var1##var2, I receive the error "interactions not allowed". I am guessing this may mean that gllamm doesn't allow interactions? How can I run this or a similar appropriate model that allows for random effects and interaction terms?
Part 2: I would also like to graph the interaction (predicted values), e.g., using a line graph or similar, preferably back in the units of the original scale (not in logarithmic form or odds ratios/incident rates), with the DV on the y-axis, var1 on the x-axis, and separate lines for var2 (is on a 7-point scale, so could be 3 lines, one at the mean and ones at +/1 SD from the mean). Any suggestions for how I could produce this graph would be greatly appreciated!
Part 1 of my question has to do with how to write STATA code for the random effects and interaction term. For my model, based on previous analysis with another program (SAS), I know I have a significant random effect for the intercept, time (time0), and var2. This is as far as I have gotten creating the code, which does not yet include the random effect of time0 or var2 (I used the STATAMULTILEVEL MIXED EFFECTS REFERENC EMANUAL RELEASE 13):
Code:
gllamm DV time0 var1 var2 var3, family(poisson) link(log) i(id) eform adapt
In addition, I believe there is a var1 x var2 interaction (level-1 interaction), but if I input var1##var2, I receive the error "interactions not allowed". I am guessing this may mean that gllamm doesn't allow interactions? How can I run this or a similar appropriate model that allows for random effects and interaction terms?
Part 2: I would also like to graph the interaction (predicted values), e.g., using a line graph or similar, preferably back in the units of the original scale (not in logarithmic form or odds ratios/incident rates), with the DV on the y-axis, var1 on the x-axis, and separate lines for var2 (is on a 7-point scale, so could be 3 lines, one at the mean and ones at +/1 SD from the mean). Any suggestions for how I could produce this graph would be greatly appreciated!
Comment