Skip to contents

Auxiliary function to estimate the standard error (variance divided by sample size) from an asymptotically normal confidence interval of level 1 - alpha by implementing the following function:

\[ \text{se} = \dfrac{U - L}{2\cdot Z_{1 - \alpha/2}} \] where U and L are the upper and lower bounds of the interval

Usage

estimator_se_from_ci(upper_limit, lower_limit, confidence_level = 0.95)

Arguments

upper_limit

Upper bound for the confidence interval

lower_limit

Lower bound for the confidence interval

confidence_level

Confidence level of the confidence interval

Value

The standard error of the estimator

Examples

# Calculate the confidence interval for a normal mean
x <- rnorm(100)
interval_mu_x <- t.test(x)$conf.int
estimator_se_from_ci(interval_mu_x[1], interval_mu_x[2], 0.95)
#> [1] -0.09608871