Hi everyone,
I'm trying to simulate aggregated binary data for meta-analysis, which consider the follow-up in both groups as the effect modifier. The Poisson mixed model will be used to see the performance. I use the following code to simulate, by setting fixed irr value and varied sample size parameters (n1, n2), varied incidence of control group (p2), varied follow-up parameter; but I found in few cases, the estimated incidence (p1) in intervention group would exceed 1. Can I just remove those exceed 1? Or is there any better data generation mechanism? Thanks
I'm trying to simulate aggregated binary data for meta-analysis, which consider the follow-up in both groups as the effect modifier. The Poisson mixed model will be used to see the performance. I use the following code to simulate, by setting fixed irr value and varied sample size parameters (n1, n2), varied incidence of control group (p2), varied follow-up parameter; but I found in few cases, the estimated incidence (p1) in intervention group would exceed 1. Can I just remove those exceed 1? Or is there any better data generation mechanism? Thanks
Code:
clear ***set random numbers of obs set obs 1 gen agen=round(runiform(40,100)) set obs `=agen' ***simulate gen studyid=_n *********************************************************************************************************** **** n1 is the treatment arm and n2 is the control arm***** gen n1vsn2=runiform(0.84, 2.04) gen logn2 = rnormal(3.353662,0.99993511) gen n2=round(exp(logn2),1) replace n2=25 if n2==0 gen n1=round(n2*n1vsn2,1) ***p2 is the incidence in control arm*** gen p2 = runiform(0.01,0.05) gen r2`s' = rbinomial(n2, p2) ****irr refers to incidence risk ratio gen tau = 0.2 gen logirr = rnormal(log(0.8), tau^2) ***t1 and t2 refer to follow up time in two arms gen t1 = runiform(1,500) gen t2 = runiform(1,500) ***using above parameters to generate p1 and r1 gen p1 = exp(logirr)*p2/(n2*t2)*(n1*t1) gen r1`s' = round(p1*n1) drop if p1 > 1

Comment