Last data update: 2014.03.03

R: Population risk time in Denmark
Y.dkR Documentation

Population risk time in Denmark

Description

Risk time (person-years) in the Danish population, classified by sex, age, period and date of birth in 1-year classes. This corresponds to triangles in a Lexis diagram.

Usage

data(Y.dk)

Format

A data frame with 13860 observations on the following 6 variables.

sex

Sex. 1:males, 2:females

A

One-year age class

P

Period

C

Birth cohort

Y

Person-years

upper

Indicator of upper triangle in the Lexis diagram

Details

The risk time is computed from the population size figures in N.dk, using the formulae devised in B. Carstensen: "Demography and epidemiology: Age-Period-Cohort models in the computer age", http://biostat.ku.dk/reports/2006/ResearchReport06-1.pdf/, later published as: B. Carstensen: Age-period-cohort models for the Lexis diagram. Statistics in Medicine, 10; 26(15):3018-45, 2007.

Source

http://www.statistikbanken.dk/statbank5a/SelectTable/omrade0.asp?SubjectCode=02&PLanguage=1&ShowNews=OFF

Examples

data(Y.dk)
str(Y.dk)
# Compute mean age, period for the triangles
attach( Y.dk )
age <- A + (1+upper)/3
per <- P + (2-upper)/3
# Plot a Lexis diagram
library( Epi )
Lexis.diagram( age=c(0,10), date=c(1990,2000), coh.grid=TRUE, int=1 )
box()
# Print the person-years for males there
text( per[sex==1], age[sex==1],
      formatC( Y[sex==1]/1000, format="f", digits=1 ) )

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(Epi)

Attaching package: 'Epi'

The following object is masked from 'package:base':

    merge.data.frame

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Epi/Y.dk.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Y.dk
> ### Title: Population risk time in Denmark
> ### Aliases: Y.dk
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data(Y.dk)
> str(Y.dk)
'data.frame':	16800 obs. of  6 variables:
 $ sex  : num  1 1 1 1 1 1 1 1 1 1 ...
 $ A    : num  0 0 1 1 2 2 3 3 4 4 ...
 $ P    : num  1971 1971 1971 1971 1971 ...
 $ C    : num  1971 1970 1970 1969 1969 ...
 $ Y    : num  19195 17944 17969 18165 18179 ...
 $ upper: num  0 1 0 1 0 1 0 1 0 1 ...
 - attr(*, "Contents")= chr "Population risk time in Denmark, in triangles of a Lexis diagram"
> # Compute mean age, period for the triangles
> attach( Y.dk )
> age <- A + (1+upper)/3
> per <- P + (2-upper)/3
> # Plot a Lexis diagram
> library( Epi )
> Lexis.diagram( age=c(0,10), date=c(1990,2000), coh.grid=TRUE, int=1 )
> box()
> # Print the person-years for males there
> text( per[sex==1], age[sex==1],
+       formatC( Y[sex==1]/1000, format="f", digits=1 ) )
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>