Learn R Programming

popEpi (version 0.4.3)

sir_exp: Calculate SMR

Description

Calculate Standardized Mortality Ratios (SMRs) using a single data set that includes observed and expected cases and additionally person-years.

sir_lex solves SMR from a Lexis object calculated with lexpand.

sir_ag solves SMR from a aggre object calculated using lexpand.

Usage

sir_exp(x, obs, exp, pyrs = NULL, print = NULL, conf.type = "profile",
  test.type = "homogeneity", conf.level = 0.95, subset = NULL)

sir_lex(x, print = NULL, breaks = NULL, ...)

sir_ag(x, obs = "from0to1", print = attr(x, "aggre.meta")$by, exp = "d.exp", pyrs = "pyrs", ...)

Arguments

x

Data set e.g. aggre or Lexis object (see: lexpand)

obs

Variable name of the observed cases in the data set

exp

Variable name or expression for expected cases

pyrs

Variable name for person-years (optional)

print

Variables or expression to stratify the results

conf.type

select confidence interval type: (default=) `profile`, `wald`, `univariate`

test.type

Test for equal SIRs. Test available are 'homogeneity' and 'trend'

conf.level

Level of type-I error in confidence intervals, default 0.05 is 95% CI

subset

a logical vector for subsetting data

breaks

a named list to split age group (age), period (per) or follow-up (fot).

...

pass arguments to sir_exp

Value

A sir object

Functions

  • sir_lex:

  • sir_ag:

Details

These functions are intended to calculate SMRs from a single data set that includes both observed and expected number of cases. For example utilizing the argument pop.haz of the lexpand.

sir_lex automatically exports the transition fromXtoY using the first state in lex.Str as 0 and all other as 1. No missing values is allowed in observed, pop.haz or person-years.

See Also

lexpand A SIR calculation vignette

Other sir functions: lines.sirspline, plot.sirspline, sir_ratio, sirspline, sir

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
BL <- list(fot = 0:5, per = c("2003-01-01","2008-01-01", "2013-01-01"))

## Aggregated data
x1 <- lexpand(sire, breaks = BL, status = status != 0, 
              birth = bi_date, entry = dg_date, exit = ex_date,
              pophaz=popmort,
              aggre=list(sex, period = per, surv.int = fot))
sir_ag(x1, print = 'period')


# no aggreate or breaks
x2 <- lexpand(sire, status = status != 0, 
              birth = bi_date, entry = dg_date, exit = ex_date,
              pophaz=popmort)
sir_lex(x2, breaks = BL, print = 'per')
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab