get_ci_norm: Calculate a normal distribution confidence interval

Description Usage Arguments Details Value References See Also Examples

View source: R/get_ci.R

Description

Calculate a normal distribution confidence interval.

Usage

1
get_ci_norm(interval, estimate, variance)

Arguments

interval

A scalar between 0 and 1, indicating the width of the interval. For example, use 0.95 to calculate a 95% confidence interval.

estimate

A numeric vector containing the point estimates.

variance

A numeric vector containing the variances.

Details

This function doesn't need to know which type of epidemiological measure has been passed as estimate (e.g., rate, risk). It also assumes that the values of the input arguments estimate and variance are aligned and that the vectors are the same length.

This function is used to construct confidence intervals in get_spec_rt() and get_ds_rt(). In general, the normal distribution should not be used to construct confidence intervals when the standard deviation is greater than a third of the mean. The function throws a warning if this is the case.

Value

A data frame with columns lower and upper, which contain the lower and upper limits of a confidence interval, respectively.

References

The STDRATE Procedure

See Also

get_ci_lnorm(), get_ci_pois(), get_ci_gamma()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# calculate a single confidence interval
get_ci_norm(interval = 0.95, estimate = 10, variance = 4)

# calculate confidence intervals around multiple estimates
get_ci_norm(interval = 0.95, estimate = c(10, 20), variance = c(4, 9))

# use columns of a data frame as inputs
df <- data.frame(estimate = c(10, 20, 30), variance = c(4, 9, 16))

# using dplyr
df %>%
  dplyr::mutate(get_ci_norm(0.975, estimate, variance))

# using base
get_ci_norm(interval = 0.975, estimate = df$estimate, variance = df$variance)

## End(Not run)

bcgov/bcEpiRate documentation built on Feb. 24, 2022, 4:05 p.m.