I am trying to load 95% CI and averages for measurements to study the size of the treatment effect. The method I want to use is called LnRR or Logarithmic Response ( 1 , 2 , 3 ). It is calculated simply Log(Response to treatment / Response to control) . If 95% CI do not overlap with 0, the probability of the effect may be more than 95%. Negative LnRR means that treatment has a negative effect.
The boot function in the boot package is a bit confusing, and I'm struggling to calculate 95% CI and average values. I tried the following:
library(boot) set.seed(2) dat <- data.frame(treatment = rnorm(10, 1.2, 0.4), control = rnorm(10, 1.5, 0.3)) boot(dat, function(x) log(x[,1]/x[,2]), R = 999) # Because LnRR = log(dat[,1]/dat[,2])
I am obviously doing something wrong. How can I load confidence intervals (boot.ci) for this type of function? I'm sure the answer is here , but for some reason I just can't figure out how to do this.
Mikko source share