Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot-methods

plots for an stpm2 fit


Description

Given an stpm2 fit, return a plot

Usage

## S4 method for signature 'stpm2'
plot(x,y,newdata,type="surv",
                      xlab="Time",line.col=1,ci.col="grey",
                      add=FALSE,ci=TRUE,rug=TRUE,
                      var=NULL,exposed=incrVar(var),times=NULL,...)
    ## S4 method for signature 'pstpm2'
plot(x,y,newdata,type="surv",
                      xlab="Time",line.col=1,ci.col="grey",
                      add=FALSE,ci=TRUE,rug=TRUE,
                      var=NULL,exposed=incrVar(var),times=NULL,...)

Arguments

x

an stpm2 object

y

not used (for generic compatibility)

newdata

required list of new data. This defines the unexposed newdata (excluding the event times).

type

specify the type of prediction

xlab

x-axis label

line.col

line colour

ci.col

confidence interval colour

ci

whether to plot the confidence interval band (default=TRUE)

add

whether to add to the current plot (add=TRUE) or make a new plot (add=FALSE) (default=FALSE)

rug

whether to add a rug plot of the event times to the current plot (default=TRUE)

var

specify the variable name or names for the exposed/unexposed (names are given as characters)

exposed

function that takes newdata and returns the exposed dataset. By default, this increments var

times

specifies the times. By default, this uses a span of the observed times.

...

additional arguments (add to the plot command)

Methods

x = "stpm2", y = "missing"

an stpm2 fit

See Also


rstpm2

Smooth Survival Models, Including Generalized Survival Models

v1.5.2
GPL-2 | GPL-3
Authors
Mark Clements [aut, cre], Xing-Rong Liu [aut], Benjamin Christoffersen [aut], Paul Lambert [ctb], Lasse Hjort Jakobsen [ctb], Alessandro Gasparini [ctb], Gordon Smyth [cph], Patrick Alken [cph], Simon Wood [cph], Rhys Ulerich [cph]
Initial release
2021-02-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.