Accounting boot intervals and average values โ€‹โ€‹for log response rate

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.

+4
source share
1 answer

I agree that the boot syntax is a bit confusing at first. The problem is that you need to write a function that accepts both your data and the vector i, which contains indexes for subsampling. Let us rewrite your function explicitly to make it clearer:

 yourFun <- function(x, i) { xSub <- x[i, ] #resample x LnRR <- log(xSub[, 1])/xSub[ ,2] return(mean(LnRR)) } 

Then do the download more or less the same as you:

 b <- boot(dat, yourFun, R=999) plot(b) #always worth looking at #Calculate ci's boot.ci(b) 
+7
source

Source: https://habr.com/ru/post/1441858/


All Articles