Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # data
- x0 <- data.frame(d1 = c(10,20,30,4)
- , n1 = c(10^3,10^4,10^3,10^2)
- , d2 = c(20,200,20,5)
- , n2 = c(10^3,10^4,10^3,10^2)
- )
- # Incidence rate ratio
- x0$irr <- with(x0, d1/n1 / (d2/n2))
- # Standard errors of ln(irr)
- x0$ln_se <- with(x0,sqrt(1/d1+1/d2))
- # Lower and upper CI
- x0$cil <- round(with(x0,exp(log(irr) - 1.96*ln_se)),3)
- x0$ciu <- round(with(x0,exp(log(irr) + 1.96*ln_se)),3)
- x0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement