Learn R Programming

SimDesign (version 0.9)

ECR: Compute the empirical coverage rate for Type I errors and Power

Description

Computes the detection rate for determining empirical Type I error and power rates using information from the confidence intervals. Note that using 1 - ECR(CIs, parameter) will provide the empirical detection rate.

Usage

ECR(CIs, parameter, tails = FALSE)

Arguments

CIs
a 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
parameter
a numeric scalar indicating the fixed parameter value
tails
logical; when TRUE returns a vector of length 2 to indicate the proportion of times the parameter was lower or higher than the supplied interval, respectively. This is mainly only useful when the coverage region is not expected to be symmetric, and theref

See Also

EDR

Examples

Run this code
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)

Run the code above in your browser using DataLab