crude_rate: Crude or age-specific rates.

Description Usage Arguments Value Note References Examples

View source: R/crude_rate.R

Description

Crude or age-specific rates.

Usage

1
crude_rate(df, events, person_yrs, base = 1e+05, level = 95, decimals = 1)

Arguments

df

A data frame.

events

Number of events.

person_yrs

Number of person-years at risk.

base

Multiplier; e.g. per 100,000 population.

level

Confidence level expressed as percentage.

decimals

Decimal places to round results.

Value

A data table with the following fields:

events

Number of events.

person_yrs

Total person-years at risk.

rate

Crude (unadjusted) rate.

rate_stderr

Standard error of rate.

rate_lci

Lower confidence limit for rate.

rate_uci

Upper confidence limit for rate.

Note

Confidence limits for crude rates are computed using the method of Garwood (1936).

References

Garwood F (1936) Fiducial limits for the Poisson distribution, Biometrika 28:437-442.

Examples

1
2
3
4
5
6
# US cancer rates by year
library(dplyr)
cancer %>% 
  group_by(Year) %>% 
  summarize_at(c("n", "pop"), sum) %>% 
  do(crude_rate(., n, pop))

mlaviolet/tidyepi documentation built on Feb. 8, 2021, 1:39 p.m.