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)
Thanks in advance for any advice.
0 Response to Calculating CIs after mixed-effects poisson
Post a Comment