Plots observations in age-time diagram for each category of categorical covariate (using the Lexis function of the Epi package)
Usage
Lexispoints(Bdata, transition, title, cov,legend)
Arguments
Bdata
Biograph object
transition
The transition selected, e.g. "NJ" in GLHS data
title
Title of Lexis diagram
cov
Covariate. Observations are plotted for each category of this covariate. If observations should be plotted for the total sample population, cov = NA
legend
legend
Value
Lcoh
Lexis object created to plot the observations
Note
requires Epi
Author(s)
Frans Willekens. The Epi package used to plot the Lexis diagram was developed by Carstensen.
References
Plummer, M. and B. Carstensen (2011) Lexis: an R class for epidemiolgoical studies with long-term follow-up. Journal of Statistical Software, 38(5):1-12
Carstensen, B. (2013) The Epi package.
See Also
Lexislines.episodes
Examples
# Example 1: ages at labour market entry, by sex
library (Epi)
data(GLHS)
#y <- Parameters(GLHS)
t <- "Calendar time and age at labour market entry"
z <- Lexispoints (Bdata=GLHS,transition="NJ",title=t,cov="sex",legend="topleft")
# Example 2: ages at first birth among married women, by religious denomination
data(NLOG98)
y <- Parameters (NLOG98)
t <- "Calendar time and age at first birth (married women)"
z <- Lexispoints (NLOG98,"MK",t,"kerk")
# Example 3: ages at leaving home, by birth cohort (any destination)
t <- "Calendar time and age at leaving parental home"
z <- Lexispoints (NLOG98,"H*",t,"cohort","topleft")
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/Lexispoints.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Lexispoints
> ### Title: Plot event dates and ages in Lexis diagram
> ### Aliases: Lexispoints
>
> ### ** Examples
>
> # Example 1: ages at labour market entry, by sex
> library (Epi)
Attaching package: 'Epi'
The following object is masked from 'package:Biograph':
Lexis.lines
The following object is masked from 'package:base':
merge.data.frame
> data(GLHS)
> #y <- Parameters(GLHS)
> t <- "Calendar time and age at labour market entry"
> z <- Lexispoints (Bdata=GLHS,transition="NJ",title=t,cov="sex",legend="topleft")
[1] Age profile: Number of individuals with transition NJ is 201
>
> # Example 2: ages at first birth among married women, by religious denomination
> data(NLOG98)
> y <- Parameters (NLOG98)
[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
> t <- "Calendar time and age at first birth (married women)"
> z <- Lexispoints (NLOG98,"MK",t,"kerk")
[1] Age profile: Number of individuals with transition MK is 291
> # Example 3: ages at leaving home, by birth cohort (any destination)
> t <- "Calendar time and age at leaving parental home"
> z <- Lexispoints (NLOG98,"H*",t,"cohort","topleft")
[1] Age profile: Number of individuals with transition H* is 456
>
>
>
>
>
> dev.off()
null device
1
>