Learn R Programming

mechkar (version 1.14.6)

age_adjusted: Returns age-adjusted proportions with its confidence interval

Description

This function is intended to calculate the age-adjusted rates given a dataset that includes age and an binary outcome. It returns the crude rates with their confidence interval and the age-adjusted rates with its confidence interval.

Usage

age_adjusted(dataset,outcome,age,agemin=0,agemax=130,source="who",alpha=0.05)

Arguments

dataset

the name of the dataframe

outcome

the name of the outcome variable

age

the name of the age variable

agemin

the minimum age to be used to calculate the weights (default=0)

agemax

the maximum age to be used to calculate the weights (default=130)

source

the name of the standard to be used for the weights (see the details section). Default: 'who'

alpha

the probability of a type I error. Default: 0.05 for the 95% CI (1-alpha)

Value

This function returns a list containing the following fields:

  • outcome - the name of the outcome variable

  • population - the total population on the dataset

  • events - the number of events for the outcome

  • crude - a list with the crude rates. This contains a list we three elements:

    • rate - the value of the crude rate

    • CImin - the value of the lower CI

    • CImax - the value of the higher CI

  • weighted - a list with the weighted rates. This contains a list we three elements:

    • rate - the value of the crude rate

    • CImin - the value of the lower CI

    • CImax - the value of the higher CI

Details

This function return a list containing nine values (see values section). It includes three types of standards: the European (euro), the American (us) and the World Health Organization (who). The confidence interval (CI) is calculated using the binomial probabilities using the binconf function of the Hmisc package. The default is to calculate the 95% CI (using an alpha of 0.05).

References

"The WHO Standard Population is defined to reflect the average age structure of the world's population over the next generation, from the year 2000 to 2025." https://www.nrscotland.gov.uk/files//statistics/age-standardised-death-rates-esp/age-standard-death-rates-background.pdf

American standard (2000): https://www.cdc.gov/nchs/data/statnt/statnt20.pdf

World (WHO 2000-2025) Standard: https://seer.cancer.gov/stdpopulations/world.who.html

Examples

Run this code
# NOT RUN {
age <- floor(runif(150,min=30,max=65))
outcome <- round(runif(150,min=0,max=1),0)
df <- data.frame(age=age,disease=outcome)
aa <- age_adjusted(df,"disease","age",agemin=30,agemax=65,source="who",alpha=0.0)
# }

Run the code above in your browser using DataLab