Learn R Programming

Epi (version 2.56)

summary.Lexis: Summarize transitions and risk time from a Lexis object

Description

A two-way table of records and transitions classified by states (lex.Cst and lex.Xst), as well the risk time in each state.

Usage

# S3 method for Lexis
summary(object, simplify = TRUE, scale = 1, by = NULL,
                          Rates = FALSE, timeScales = FALSE, ...)
  # S3 method for summary.Lexis
print(x, ..., digits = 2)

Value

An object of class summary.Lexis, a list with two components,

Transitions and Rates, each one a matrix with rows classified by states where persons spent time, and columns classified by states to which persons transit. The Transitions contains number of transitions and has 4 extra columns with number of records, total number of events, total risk time and number of person contributing attached. The Rates contains the transitions rates.

If the argument Rates is FALSE (the default), then only the first component of the list is returned.

Arguments

object

A Lexis object.

simplify

Should rows with 0 follow-up time be dropped?

scale

Scaling factor for the rates. The calculated rates are multiplied by this number.

by

Character vector of name(s) of variable(s) in object. Used to give a separate summaries for subsets of object. If longer than than 1, the interaction between that variables is used to stratify the summary. It is also possible to supply a vector of length nrow(object), and the distinct values of this will be used to stratify the summary.

Rates

Should a component with transition rates be returned (and printed) too?

timeScales

Should the names of the timescales and the indication of since which entry also be given?

x

A Lexis or summary.Lexis object.

digits

Number of digits after the decimal separator used when printing the summary.

...

Ignored.

Author

Bendix Carstensen, http://bendixcarstensen.com

Examples

Run this code
data( nickel )
# Lung cancer deaths and other deaths are coded 1 and 2
nic <- Lexis( data = nickel,
             entry = list(age = agein),
              exit = list(age = ageout,cal = ageout+dob,tfh = ageout-age1st),
       exit.status = factor( (icd > 0) + (icd %in% c(162,163)),
                           labels = c("Alive","Other","Lung") ) )
str( nic )
head( nic )
summary( nic )
# More detailed summary, by exposure level
summary( nic, by = nic$exposure>5, Rates = TRUE, scale = 100 )

Run the code above in your browser using DataLab