get_ci_lnorm: Calculate a log normal distribution confidence interval

Description Usage Arguments Details Value References See Also Examples

View source: R/get_ci.R

Description

Calculate a log normal distribution confidence interval.

Usage

1
get_ci_lnorm(interval, estimate, variance_log)

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_log

A numeric vector containing the variances of the log-transformed estimate.

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_log 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().

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_norm(), 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_lnorm(interval = 0.95, estimate = 0.2, variance_log = 0.05)

# calculate confidence intervals around multiple estimates
get_ci_lnorm(interval = 0.95, estimate = c(0.2, 0.4), variance_log = c(0.05, 0.025))

# use columns of a data frame as inputs
df <- data.frame(estimate = c(0.2, 0.4), variance_log = c(0.05, 0.025))

# using dplyr
df %>%
  dplyr::mutate(get_ci_lnorm(0.975, estimate, variance_log))

# using base
get_ci_lnorm(interval = 0.975, estimate = df$estimate, variance_log = df$variance_log)

## End(Not run)

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