direct_adjust: Directly age-adjusted rates.

View source: R/direct_adjust.R

direct_adjustR Documentation

Directly age-adjusted rates.

Description

Compute age-adjusted rates using direct standardization.

Usage

direct_adjust(
  df,
  agegroup,
  events,
  person_yrs,
  std_pop,
  base = 1e+05,
  level = 95,
  decimals = 4
)

Arguments

df

A data frame with columns for age group, event counts, and person-years totals as described in the next three arguments

agegroup

Age group or other stratifying variable.

events

Number of events.

person_yrs

Number of person-years at risk.

std_pop

Vector of standard population distribution. Can be totals, proportions, or percentages.

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.

adj_rate

Age-adjusted rate.

adj_rate_stderr

Standard error of age-adjusted rate.

adj_lci

Lower confidence limit of age-adjusted rate per Tiwari (2006)

adj_uci

Upper confidence limit for age-adusted rate per Tiwari.

crude_rate

Crude (unadjusted) rate.

crude_lci

Lower confidence limit for crude rate, per Garwood (1936).

crude_uci

Upper confidence limit for crude rate, per Garwood.

Note

Confidence limits for adjusted rates are computed using the method of Tiwari et al. (2006). The upper limit is adjusted with a continuity correction prompted by the use of a continuous distribution (gamma) to approximate a discrete random variable (Poisson).

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

References

Anderson RN and Rosenberg HM (1998) Age standardization of death rates: Implementation of the year 2000 standard. National Vital Statistics Reports 47(3). Hyattsville, Maryland: National Center for Health Statistics. https://www.cdc.gov/nchs/data/nvsr/nvsr47/nvs47_03.pdf

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

Tiwari RC et al. (2006) Efficient interval estimation for age-adjusted cancer rates. Statistical Methods in Medical Research 15:547-569. https://www.ncbi.nlm.nih.gov/pubmed/17260923

Examples

# US age-adjusted cancer rates by year and sex
# using standard SEER age groups 0, 1-4, 5-9, 10-14, 15-19, ..., 80-84,
library(dplyr)
cancer_by_year_sex <- cancer %>%
  group_by(Year, Sex) %>%
  group_modify(~ direct_adjust(.x, agegroup, n, pop, std_pop_list$seer_pop))

# same rates by year
cancer_by_year <- cancer %>%
  group_by(Year, agegroup) %>%
  summarize(across(c(n, pop), sum)) %>% 
  group_modify(~ direct_adjust(.x, agegroup, n, pop, std_pop_list$seer_pop))
  

mlaviolet/tidyepi documentation built on May 14, 2022, 10:04 p.m.