plot.thregI: plot survival, hazard and density curves

Description Usage Arguments Examples

Description

Display the graphs of the estimated survival, hazard or density function at different levels of a categorical variable which has been included in the threshold regression model by thregI(). There are three options, "sv", "hz" and "ds" are for survival, hazard and density function, respectively.

Usage

1
2
## S3 method for class 'thregI'
plot(x,var,scenario,graph,nolegend=0,nocolor=0,...)

Arguments

x

a thregI object.

var

specifies the name of the variable which is required to be categorical. For each level of which (survival, hazard, density) the plots would be generated at given scenario specified by the scenario argument.

scenario

specifies a scenario for predicted plots.

graph

specifies the type of curves to be generated. The "sv" option is to plot survival function, the "hz" option is to plot hazard function and the "ds" option is to plot density function.

nolegend

set nolegend to be 1 when no need for legend. Users can add legends by themselves after set nolegend=1.

nocolor

set nocolor to be 1 if users would like to have all curves in black.

...

for future methods

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#load the data "bcos"
data("bcos", package="thregI")

# transform the "treatment" variable into factor variable f.treatment
bcos$f.treatment=factor(bcos$treatment)

# fit the threshold regression model on the factor variable f.treatment
fit<-thregI(Surv(left, right, type='interval2')~f.treatment|f.treatment,data=bcos)

# estimated survival function at all levels of a categorical variable
plot.thregI(fit, var = f.treatment, graph = "sv", nocolor = 1)

# estimated hazard function at all levels of a categorical variable
plot.thregI(fit, var = f.treatment, graph = "hz", nocolor = 1)

# estimated density function at all levels of a categorical variable
plot.thregI(fit, var = f.treatment, graph = "ds", nocolor = 1)

thregI documentation built on May 2, 2019, 6:27 a.m.