```
data(poynard)
#CREATE META SUMMARY OF LOG-OR EFFECT SIZE FOR 2-YR BLEEDING EVENTS
binary.mean <- function(x){
n <- length(x)
if(sum(x)==0){
return(.5/(n+.5))
}
else if(sum(x)==n){
return(n/(n+.5))
}
else{
return(mean(x))
}
}
logit <- function(x){log(x/(1-x))}
meta <- data.frame(p0=sapply((poynard$bleed0/poynard$n0),binary.mean))
meta$p1 <- sapply((poynard$bleed1/poynard$n1),binary.mean)
meta$y0 <- logit(meta$p0)
meta$y1 <- logit(meta$p1)
meta$var0 <- 1/(meta$p0*(1-meta$p0))
meta$var1 <- 1/(meta$p1*(1-meta$p1))
meta$n0 <- poynard$n0
meta$n1 <- poynard$n1
#ALTERNATIVE HYPOTHESIS FOR AGE-TREATMENT EFFECT
#WITH 10 YEARS CHANGE TO OR TREATMENT EFFECT exp(beta*10)
#EFFECT MODIFIER CHANGES TREATMENT EFFECT BY 30%
beta = log(1.3)/10
ipd.power <-
ipd.meta.power(
int=beta,
y0=meta$y0,y1=meta$y1,
var0=meta$var0,var1=meta$var1,
n0=meta$n0,n1=meta$n1,
x0=poynard$age0,x1=poynard$age1,
s20=poynard$age.s20,s21=poynard$age.s21
)
ipd.power
```

Run the code above in your browser using DataCamp Workspace