R: Displays occurrences, exposures and transition rates in a...
LexisOccExp
R Documentation
Displays occurrences, exposures and transition rates in a Lexis diagram
Description
The Lexis diagram is an age-time framework. The diagram displays transition data in two time dimensions, e.g. calendar date and age. The Lexis class in the EPI package is an object-based framework for managing transition data on multiple time scales. The function displays occurrences, exposures and transition rates for a selected transltion. The user also determines the age and time interval.
Usage
LexisOccExp(Bdata, transition, nyear)
Arguments
Bdata
Data in Biograph format (Biograph object)
transition
The transition selected. A transition is identified by the state of origin and the state of destination.
nyear
The age and time interval, generally 5 years.
Details
The presentation of data in the Lexis diagram is particularly helpful to explain the concept of occurrence-exposure rate. The functions plots Lexis diagrams for event counts, exposures and transition rates. In addition, it produces an object with as components the event counts, exposures and rates. It also produces a survival object, which can be used for further survival analysis with the survival package, and a Lexis object, which can be used for further analysis with the Epi package.
Value
surv
The survival object. The survival object is used as a response variable in survival models (see the survival package in CRAN)
Lcoh
The Lexis object. The Lexis object is a key object in the Epi package.
nevents
Event counts: number of transitions by age, origin and destination
ndur
Exposure times: duration exposed to the risk of experiencing the selected transition.
rates
The transition rates (occurrence-exposure rates). They are obtained by dividing the event counts by the exposure times.
Author(s)
Frans Willekens
References
Carstensen, B. (2007) Age-Period-Cohort models for the Lexis diagram. Statistics in Medicine, 26(15):3018-3045.
Carstensen, B. (2013) The Epi package.
Examples
# The following example selects the "JN" transitions from the GLHS data
# and produces Lexis diagrams with age and time intervals of 5 years data (GLHS)
data (GLHS)
w <- LexisOccExp (Bdata=GLHS,transition= "JN",nyear=5)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(Biograph)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Biograph/LexisOccExp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: LexisOccExp
> ### Title: Displays occurrences, exposures and transition rates in a Lexis
> ### diagram
> ### Aliases: LexisOccExp
>
> ### ** Examples
>
> # The following example selects the "JN" transitions from the GLHS data
> # and produces Lexis diagrams with age and time intervals of 5 years data (GLHS)
> data (GLHS)
> w <- LexisOccExp (Bdata=GLHS,transition= "JN",nyear=5)
[1] Age profile: Number of individuals with transition JN is 134
[1] "Closed intervals = 134"
[1] "Open intervals = 0"
[1] Create Lexis object
[1] "Exposure time = 2095.61 years or 25147.32 months"
There were 50 or more warnings (use warnings() to see the first 50)
>
>
>
>
>
> dev.off()
null device
1
>