Announcement

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

  • Simulation using incidence risk ratio

    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

    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
    Last edited by Chang Xu; 23 May 2022, 21:23.

  • #2
    That is the limitation of using IRRs for binary data: it does not guarantee that the upper bound of 1 is respected. If the event under study is rare, then you are probably fine, but in your case that is apparently not the case. In that case you can use odds ratios and logistic regression.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thanks Buis.

      Yes, this is a big problem when we using RR/RD/IRR as true effect. For OR, it can avoid such a problem, but seems cannot use OR to define a true IRR?

      Kind regards
      Chang

      Comment

      Working...
      X