plot.st: Plots for Survival Curves

Description Usage Arguments Value Examples

View source: R/plot.st.R

Description

Plots of survival curves for treatment, control and their difference by 3 methods (KM, IPTW, EL).

Usage

1
2
3
plot.st(y,delta,treat,x,psix_moment=c("first","second"),t,
method = c("KM","IPTW","EL"),Nboot=500,
standardize=FALSE,alpha=0.05)

Arguments

y

a numeric vector of observed time

delta

a factor vector of indicator for events

treat

a factor vector of the treatment indicator

x

an optional covariance matrix containing the variables in the model

psix_moment

first or second, which correspond to adjusting first or second moments of the covariates matrix x. Only applied when method="EL"

t

a numeric vector of time points for estimation

method

the estimation method selected from KM, IPTW or EL

Nboot

number of iterations in Bootstrap, default by 500. Only applied when method="EL"

standardize

a logical object of whether the covariance matrix x would be centered and scaled, default by FALSE

alpha

alpha level for the conficendence interval, default by 0.05

Value

A plot object with survival curves for treatment, control and their difference with pointwise 95% confidence intervals. The CIs for KM and IPTW are asymptotic estimates, for EL is estimated by the quantiles of Bootstrap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(survival)
y <- as.matrix(gbsg$rfstime/(365.25/12))
treat <- data.matrix(gbsg$hormon)
delta <- as.matrix(gbsg$status)
x <- data.matrix(gbsg[,c("age","meno","size","grade","nodes","pgr","er")])
t <- seq(0,80,2)

plot.st(y=y,delta=delta,treat=treat,x=x,t=t,method="KM",alpha=0.05)
plot.st(y=y,delta=delta,treat=treat,x=x,t=t,method="IPTW",alpha=0.05)
plot.st(y=y,delta=delta,treat=treat,x=x,psix_moment="second",t=t,
method="EL",Nboot=500,standardize=TRUE,alpha=0.05)

kimihua1995/adjKMtest documentation built on Jan. 1, 2021, 7:20 a.m.