dsr: Compute Directly Standardized Rates

Description Usage Arguments References Examples

View source: R/dsr.R

Description

Computes crude and directly standardized rates by subgroup with confidence intervals.

Usage

1
2
dsr(data, event, fu, subgroup, ..., refdata, mp, method = "normal",
  sig = 0.95, decimals)

Arguments

data

A data frame with counts and unit-times summarized by the standardization variables.

event

A variable within the input data that corresponds to the event counts.

fu

A variable within the input data that corresponds to the unit-time.

subgroup

A variable within the input data frame for which rates are calculated by.

...

Variables(s) within the input data that for which rates are to be standardized by. The input data and ref data should both be summarized by these.

refdata

A data frame with population unit-times summarized by the standardization variables. The unit-time variable name must named pop.

mp

A constant to multiply rates by (e.g. mp=1000 for rates per 1000).

method

Choose between normal, lognormal and gamma confidence intervals for crude and standardized rates. The default method is normal.

sig

The desired level of confidence in computing confidence intervals. The default is 0.95 for 95 percent CIs.

decimals

Round estimates to a desired decimal place.

References

Fay, M.P., & Feuer, E.J. (1997). Confidence intervals for directly standardized rates: a method based on the gamma distribution. Statistics in Medicine,16, 791-801.

Elandt-Johnson, R. C., and Johnson, N. L. (1980). Survival Models and Data Analysis. New York: John Wiley & Sons.

Chiang C. Standard error of the age-adjusted death rate. US Department of Health, Education and Welfare: Vital Statistics Special Reports 1961;47:271-285.

Schoenbach, V., and Rosamond W. (2000) Understanding the fundamentals of epidemiology: An evolving text.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#An example of calculating directly standardized rates
#Data from Table 1, Page 132 of Schoenbach (2000)

#State specific death counts and fu
df_study <- data.frame(state=rep(c('Miami',"Alaska"), c(5,5)),
                      age=rep(c('00-14','15-24','25-44','45-64','65+'),2),
                      deaths=c(136,57,208,1016,3605,59,18,37,90,81),
                      fu=c(114350,80259,133440,142670,92168,37164,20036,32693,14947,2077))

#US standard population
df_ref  <- data.frame(age=c('00-14','15-24','25-44','45-64','65+'),
                     pop=c(23961000,15420000,21353000,19601000,10685000))

#Directly Standardized Rates (per 1000) - 95% CI's using the gamma method
my_results <- dsr(data=df_study,
                 event=deaths,
                 fu=fu,
                 subgroup=state,
                 age,
                 refdata=df_ref,
                 method="gamma",
                 sig=0.95,
                 mp=1000,
                 decimals=4)
#View results
my_results

dsr documentation built on Aug. 23, 2019, 5:04 p.m.