Skip to contents

This function computes an approximate confidence interval of a point estimate (i.e. the summary statistic).

Usage

computeStandardCI(
  obs,
  rnd,
  conf.level = 0.95,
  distribution = c("normal", "t"),
  n,
  na.rm = FALSE
)

Arguments

obs

a numeric scalar representing the observed value of the summary statistic.

rnd

numerical vector containing the permutation/bootstrap replication of the statistics.

conf.level

the desired confidence level.

distribution

sampling distribution of the estimate. Use "normal" if the population has unknown mean and known variance (or if the sample size n is large); "t" if the population variance is unknown and sample size is small.

n

sample size, used to compute the degrees of freedom if distribution = "t".

na.rm

logical, whether NA values should be removed before computing the standard error. Defaults to FALSE.

Value

A named numeric vector with 2 elements, lower and upper, the lower and upper bounds of the confidence interval for the point estimate.

Details

The confidence interval provides additional information about the variability of a point estimate and it is generally defined as

$$CI = estimate \pm \textit{margin of error} = estimate \pm \textit{critical value} \times \textit{standard error}$$

where \(\textit{estimate}\) is the sample statistic estimating the population parameter of interest; \(\textit{critical value}\) is a value based on the sampling distribution of the estimate and the desired confidence level; \(\textit{standard error}\) is the standard deviation of the point estimate.

Author

Alessandro Barberis