1 - ECR(CIs, parameter)
will provide the empirical
detection rate.
ECR(CIs, parameter, tails = FALSE)
numeric
vector or matrix
of confidence interval values for a
given parameter value, where the first element/column indicates the lower confidence interval
and the second element/column the upper confidence interval. If a
vector of length 2 is passed instead then the returned value will be either a 1 or 0 to indicate
whether the parameter value was or was not within the interval, respectivelynumeric
vector object with length equal to the number of rows as CIs
(use to compare sets of parameters
at once)1 - sum(ECR(CIs, parameter, tails=TRUE)) == ECR(CIs, parameter)
EDR
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)
Run the code above in your browser using DataLab