Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculating CIs after mixed-effects poisson

    Hi all, I'm trying to graph the results of a mixed-effects poisson model and have come across some issues calculating 95% confidence intervals.

    This is the model and code I used to calculate CIs:
    Code:
    meqrpoisson count age c.age#c.age || _all: R.year || birthcohort:
    
    // Store estimates, generate predicted values
    estimates store m1
    predict pred, mu
    
    // Store fixed and random effects SEs
    predict se_age, stdp
    predict re_year re_cohort, reffects reses(se_year se_cohort)
    
     // Create predicted values to demonstrate effects
    bysort cohort : egen RiskyBehaviours_cohort = mean(pred)
    bysort age : egen RiskyBehaviours_age = mean(pred)
    bysort year : egen RiskyBehaviours_year = mean(pred)
    
    // Calculate 95% CIs
    gen cohort_lower = RiskyBehaviours_cohort - (1.96*se_cohort)
    gen cohort_upper = RiskyBehaviours_cohort + (1.96*se_cohort)
    
    gen age_lower = RiskyBehaviours_age - (1.96*se_age)
    gen age_upper = RiskyBehaviours_age + (1.96*se_age)
    
    gen year_lower = RiskyBehaviours_year - (1.96*se_year)
    gen year_upper = RiskyBehaviours_year + (1.96*se_year)
    This results in the lower bound of some CIs being negative, which seems wrong for a poisson model. Is this method of calculating the CIs incorrect?

    Thanks in advance for any advice.
Working...
X