incrate: Age standardized rate analysis

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/incrate.R

Description

This function calculates age-standardized incidence and mortality rates for CPSII Mortality and Nutrition Cohorts analyses.

Usage

1
2
incrate(dat=df, agedist, agegrps=NULL, dtint, birthday,
                    failtime, outcome, expo)

Arguments

dat

data.frame used in the analysis (default is "df" for use in modeling functions)

agedist

Age distribution standard (see nutweightlist documentation for details)

agegrps

Vector of start ages for the analysis. Default is 5-year age groups starting at age 40-44, 45-59,... 85+. To collapse ages, provide a vector of the ages you want each group to start with. For example, if you wanted to use 10-year age groups you would provide: c(40,50,60,70,80) to create age groups 40-49, 50-59, 60-69, 70-79, 80+. For 2 age groups (<65 and 65+) you would provide the vector c(40,65).

dtint

Variable name for the start of followup. Example: "dtint92", "dtint97", etc.

birthday

Variable name exact birthdate, typically "BDAYDATE" in our master file.

failtime

Variable name for fail time in days

outcome

Variable name for your outcome, formatted 0=control, 1=case

expo

Factor variable for your exposure.

Details

These rates are calculated using the pyrs() function in the survival package. Age-specific time and events are tabulated as each CPSII participant moves through calendar time. For example, if a participant enrolls in the study at age 49, they will contribute person time to the age 45-49 age group until their 50th birthday, and then start contributing person time to the 50-54 age group. Events are assessed at this attained age.

The pyrs() function simply calculated age- and strata-specific person years and events. The rest of the function calculates the age-adjustment and final rates.

Value

The function returns a list of age-specific person-years and rates for each exposure level of your variable. Also includes:

Std.Rates

Final age-standardized rates calculated for each exposure level

Author(s)

Brian Carter

See Also

weightlist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
df <- example.data
df$failtime <- as.numeric(df$dateft)-as.numeric(df$dtint92)
rates <- incrate(dat=df,
                 agedist="YEARS00",
                 agegrps=c(40,65),
                 dtint="dtint92",
                 birthday="bdaydate",
                 failtime="df$failtime",
                 outcome="dead",
                 expo="smoke92")

print(rates$Std.Rate)
  

buddha2490/BERG documentation built on Feb. 7, 2020, 6:01 p.m.