I need to bootstrap a a relative effect estimate calculated from paired binary data and I don't know how to do this. Below example data set:
# Create test data
n <- 1000
treated <- rbinom(n, 1, 0.7)
control <- rbinom(n, 1, 0.5)
data <- cbind(treated, control)
# How to calculate relative effect
(sum(treated)-sum(control))/sum(control)*100
So, I should draw N random samples from the data set so that the row-wise pairs would be conserved, calculate the relative effect described above for each sample and then calcuate a desired statistic (mean or median) of the effect. I also would like to calculate the 95 % confidence interval of the bootstrap statistic. Is there any way to do this using an existing bootstrapping function (for example from package "boot") or should I define a custom function?