get_smr: Calculate a standardized morbidity/mortality ratio

Description Usage Arguments Details Value References See Also Examples

View source: R/get_smr.R

Description

Calculate a standardized morbidity/mortality ratio (SMR) or the expected number of events in each stratum. The SMR is the number of observed events divided by the expected events.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
get_smr(
  count,
  popn,
  std_r,
  std_measure = "rate",
  output_type = "ratio",
  percent = FALSE,
  dist = NULL,
  interval = NULL
)

Arguments

count

A scalar, the number of observed events.

popn

A numeric vector containing the size of each stratum in the observed population.

std_r

A numeric vector containing the rate or risk of each stratum in the standard population.

std_measure

A string to indicate whether the values in std_r are rates or risks, which is used to calculate the expected number of events in each stratum. Currently, this function only supports the calculation of rate SMRs (default is "rate"). The calculation of risk SMRs will be implemented in the future.

output_type

If "ratio" (default), the SMR is returned. If "counts", the expected number of events in each stratum is returned.

percent

If FALSE (default), the SMR is returned as is (e.g. 0.5). If TRUE, the SMR is expressed as a percentage (e.g. 50).

dist

A string to indicate the type of probability distribution for the confidence interval to follow. Can be one of the following: "normal", "log normal" or "poisson". This parameter is case insensitive.

interval

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

Details

This low-level function assumes that the size of each stratum in the observed population and the rate or risk of each stratum in the standard population are provided in the same order.

To construct confidence intervals for the ratio estimates, arguments must be supplied to both dist and interval.

Value

If output_type == "ratio" (default) and neither dist nor interval is supplied, the SMR is returned as a numeric vector.

If output_type == "ratio" and both dist and interval are provided, then a data frame with the columns smr, lower, upper and interval is returned.

If output_type == "counts", the expected number of events in each stratum is returned as a numeric vector.

References

The STDRATE Procedure

See Also

get_ci_norm(), get_ci_lnorm(), get_ci_pois()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
count <- 1500
popn <- c(13358, 13029, 34378, 39649, 11671)
std_r <- c(0.004, 0.003, 0.007, 0.011, 0.013)

get_smr(count = count, popn = popn, std_r = std_r, output_type = "ratio")
get_smr(count = count, popn = popn, std_r = std_r, output_type = "counts")
get_smr(count = count, popn = popn, std_r = std_r, percent = TRUE)
get_smr(
  count = count, popn = popn, std_r = std_r,
  dist = "normal", interval = 0.95
)
get_smr(
  count = count, popn = popn, std_r = std_r,
  percent = TRUE, dist = "normal", interval = 0.95
)

## End(Not run)

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