# NOT RUN {
CIs <- matrix(NA, 100, 2)
for(i in 1:100){
dat <- rnorm(100)
CIs[i,] <- t.test(dat)$conf.int
}
ECR(CIs, 0)
ECR(CIs, 0, tails = TRUE)
# single vector input
CI <- c(-1, 1)
ECR(CI, 0)
ECR(CI, 2)
ECR(CI, 2, tails = TRUE)
# parameters of the same size as CI
parameters <- 1:10
CIs <- cbind(parameters - runif(10), parameters + runif(10))
parameters <- parameters + rnorm(10)
ECR(CIs, parameters)
# average width of CIs
ECR(CIs, parameters, CI_width=TRUE)
# ECR() for multiple CI estimates in the same object
parameter <- 10
CIs <- data.frame(lowerCI_1=parameter - runif(10),
upperCI_1=parameter + runif(10),
lowerCI_2=parameter - 2*runif(10),
upperCI_2=parameter + 2*runif(10))
head(CIs)
ECR(CIs, parameter)
ECR(CIs, parameter, tails=TRUE)
ECR(CIs, parameter, CI_width=TRUE)
# often a good idea to provide names for the output
ECR(CIs, parameter, names = c('this', 'that'))
ECR(CIs, parameter, CI_width=TRUE, names = c('this', 'that'))
ECR(CIs, parameter, tails=TRUE, names = c('this', 'that'))
# }
Run the code above in your browser using DataLab