demog_pyears: Events and person-years from episode data for demographic...

Description Usage Arguments Details See Also

View source: R/demog_pyears.R

Description

This is a wrapper for the pyears function in the survival package with convenient stratifications for demographic analyses.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
demog_pyears(
  formula,
  data,
  period = NULL,
  agegr = NULL,
  cohort = NULL,
  tips = NULL,
  origin = 1900,
  scale = 12,
  dob = "(dob)",
  intv = "(intv)",
  tstart = "tstart",
  tstop = "tstop",
  event = "event",
  weights = NULL
)

Arguments

formula

a formula object. The response variable will be a vector of follow-up times for each subject, or a Surv object containing the survival time and an event indicator. The predictors consist of optional grouping variables separated by + operators (exactly as in survfit), time-dependent grouping variables such as age (specified with tcut), and optionally a ratetable term. This latter matches each subject to his/her expected cohort.

data

a data frame in which to interpret the variables named in the formula, or in the subset and the weights argument.

period

Numeric vector defining calendar periods to stratify analysis, use NULL for no periods.

agegr

Numeric vector defining ages in years for splits.

cohort

Numeric vector defining birth cohorts to stratify analysis, use NULL for no cohort stratification.

tips

Break points for TIme Preceding Survey.

origin

Origin year for date arguments. 1900 for CMC inputs.

scale

a scaling for the results. As most rate tables are in units/day, the default value of 365.25 causes the output to be reported in years.

dob

Variable name for date of birth (character string).

intv

Variable name for interview date (character string).

tstart

Variable name for the start of follow up time, example is date of birth. Default is 'tstart'.

tstop

Variable name for the end of follow up time, examples include interview date or date of death. Default is 'tend'.

event

Variable name for the event indicator, example is birth or death. Default is 'event'.

weights

case weights.

Details

Note that event must be a binary variable per the internals of the pyears() function. The function could be updated to work around this stipulation.

See Also

pyears, tcut


mrc-ide/demogsurv documentation built on Nov. 21, 2021, 2:05 p.m.