Last data update: 2014.03.03

R: Plots survival function.
plot.MSLT.SR Documentation

Plots survival function.

Description

Plot method for object of class 'MSLT.S' using the ggplot2 package. It plots the multistate survival function by as estimated by MSLT.S

Usage

## S3 method for class 'MSLT.S'
plot(x, e0, order,colours,title,area,xmin,xmax,...)

Arguments

x

The multistate survival function. An object of class MSLT.S produced by the MSLT.S function. It is one of two components of the object produced by the MSLT.S function.

e0

Life expectancy at reference age (e.g. at birth)

order

Desired sequence of states in plot

colours

Colours

title

Title for multistate survival plot

area

Graph type: area (area=TRUE) or bar (area=FALSE)

xmin

Minimum value on x-axis

xmax

Maximum value on x-axis

...

Further arguments to plot

Value

The function plot.MSLT.S returns the multistate survival function (S) and the plot. It returns an object with the following components:

S

The multistate survival function (values used in the plot)

plot

The plot produced by the ggplot2 package.

Author(s)

Frans Willekens

See Also

MSLT.S

Examples

   	
# The multistate life table based on occurrence-exposure rates
    data (GLHS)
    param <- Parameters (GLHS)
    cr <- Cumrates (irate=3,Bdata=GLHS)
    S <- MSLT.S(cr$oe)
    radix <- c(10000,0)
    mslt <- MSLT.e (S,radix)
    
# Plot the multistate survival function (object of class 'MSLT.S' )
    z<- plot (x=S$S,e0=mslt$e0,title="Multistate survival function",area=TRUE,order=c("N","J"))

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/plot.MSLT.S.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot.MSLT.S
> ### Title: Plots survival function.
> ### Aliases: plot.MSLT.S
> 
> ### ** Examples
>    	
> # The multistate life table based on occurrence-exposure rates
>     data (GLHS)
>     param <- Parameters (GLHS)
[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
>     cr <- Cumrates (irate=3,Bdata=GLHS)
[1] ". . . . . .  Removing intrastate transitions . . . . . "
[1] . . . . . .   Removes intrastate transitions . . . .
[1] . . . . Intrastate transitions removed. Recalculating transitions . . . . 
[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
[1] A new Biograph object without intrastate transitions is returned.
[1] ". . . . . . Estimating rates . . . . ."
[1] "  "
[1] "Cumrates: calls function Biograph.mvna  . . . "
  ID born start      end    sex edu marriage LMentry  cohort path      Tr1
1  1  351     0 52.66667   Male  17      679     555 1929-31   NJ 17.00000
2  2  357     0 52.16667 Female  10      762     593 1929-31  NJN 19.66667
3  3  473     0 42.50000 Female  11      870     688 1939-41  NJN 17.91667
4  4  604     0 31.58333 Female  13      872     872 1949-51  NJN 22.33333
5  5  377     0 50.50000   Male  11      701     583 1929-31   NJ 17.16667
       Tr2 Tr3 Tr4 Tr5 Tr6 Tr7 Tr8 Tr9 Tr10 Tr11 Tr12
1       NA  NA  NA  NA  NA  NA  NA  NA   NA   NA   NA
2 44.66667  NA  NA  NA  NA  NA  NA  NA   NA   NA   NA
3 29.66667  NA  NA  NA  NA  NA  NA  NA   NA   NA   NA
4 26.91667  NA  NA  NA  NA  NA  NA  NA   NA   NA   NA
5       NA  NA  NA  NA  NA  NA  NA  NA   NA   NA   NA
[1] No intra-state transitions present in the data.
[1] "      Biograph.mvna: Calls function Biograph.long . . . "
[1] . . . . .  Creating long format  . . . . . .
[1] . . . . .  running reshape  . . . . . 
[1]  . . . . Sort data in long format  . . . . 
[1]  . . . . Adjust long format for survival package etc . . .  
[1]      Biograph.mvna completed: Object produced by Biograph.mvna: .$mvna 
[1] "Cumrates 88"
[1] ". . . . . . . . . . . . "
[1] ". . . . Running mvna . . . . . . "
[1] Computing occurrence-exposure rates
[1] Running Sequences.ind
[1] Running Occup
[1] The number of age groups is 54
[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
[1] ". . . .  Running Occup . . . . "
[1] ". . . . Running function Parameters . . . . "
[1] "Exploring types of transitions"
[1] "state_time: compute state.n"
[1] Running Trans
[1] Running RateTable
[1] Running Rates
>     S <- MSLT.S(cr$oe)
>     radix <- c(10000,0)
>     mslt <- MSLT.e (S,radix)
>     
> # Plot the multistate survival function (object of class 'MSLT.S' )
>     z<- plot (x=S$S,e0=mslt$e0,title="Multistate survival function",area=TRUE,order=c("N","J"))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>