stat_t.plot {WINS} | R Documentation |
Plot Win Statistics over the Study Time.
Description
Plot the win statistics as a function of the study time for time-to-event endpoints only. The function "win.stat" is called to calculate the win statistics at each time in the plot function.
Usage
stat_t.plot(data, Ctime = Inf, arm.name = c(1,2), priority = c(1,2),
statistic = c("WR","NB","WO"),
Z_t_trt = NULL, Z_t_con = NULL, tau = 0,np_direction = "larger",
stratum.weight = c("unstratified","MH-type","wt.stratum1","wt.stratum2","equal"),
censoring_adjust = c("No","IPCW","CovIPCW"),
win.strategy = NULL, plotTimeUnit = NULL,
plot_CI = FALSE, alpha = 0.05, ...)
Arguments
data |
The analysis dataset which contains the following variables:
|
Ctime |
A vector of study times, at which the win proportions are to be plotted. Study time for a subject is the time since the subject is accrued, default as Inf. |
arm.name |
A vector for the labels of the two experimental arms, default to be c(1,2). The first label is for the treatment group, and the second label is for the control group. |
priority |
Importance order (from the most to the least important). For example, given three endpoints with the importance order as Endpoint 3, Endpoint 2, and Endpoint 1, input priority = c(3,2,1). |
statistic |
The win statistic to be plotted.
|
Z_t_trt |
A matrix for the covariate history, each row is a (p+2) vector for one record of each subject in the treatment group. The first two columns are subject id, time, the other columns are the covariates (vector of length p). The baseline covariates are provided as the observed covariates corresponding to time 0. |
Z_t_con |
A matrix for the covariate history, each row is a (p+2) vector for one record of each subject in the control group. The first two columns are subject id, time, the other columns are the covariates (vector of length p). The baseline covariates are provided as the observed covariates corresponding to time 0. |
tau |
A vector of numerical value for the magnitude of difference to determine win/loss/tie for each endpoint. If tau is input as scalar, the function treat the taus for TTE endpoints and continuous endpoints to be the same and taus for binary endpoints as 0. Default as 0 for all endpoints. |
np_direction |
A vector of character for the direction to define a better result for each endpoint.
|
stratum.weight |
The weighting method for each stratum. Default is "unstratified" for unstratified analysis. A stratified analysis is performed if other weight option is specified. Other possible choices for this argument are listed below.
|
censoring_adjust |
The method to adjust censoring for the kernal functions. Possible choices are listed below.
|
win.strategy |
The strategy to determine the win status. Default as NULL. If NULL, the default win strategy funtion "win.strategy.default" is called, see win.strategy.default for more details. Users can also define their own "win.strategy" function. |
plotTimeUnit |
The time units, e.g., "days", "months", "years", default as NULL. |
plot_CI |
If TRUE, plot the pointwise confidence interval, default as FALSE. |
alpha |
The significance level, default to be 0.05. |
... |
Argument passed from user defined functions "win.strategy" if there is any. For instructions on this "win.strategy" function, see win.strategy.default for more details. |
Value
A ggplot2 object.
Examples
#### An simulated example with two TTE endpoints.
data <- sim.data(n_trt = 200, n_con = 200, n_ep = 2, arm.name = c("A","B"),
ep_type = "tte", cdist.rate = 0.5, sim_method = "copula",
copula_trt=copula::normalCopula(0.9), margins_trt=c("gamma", "beta"),
paramMargins_trt=list(list(shape=2, scale=1),list(shape1=2, shape2=2)),
copula_con=copula::normalCopula(0.9), margins_con=c("gamma", "beta"),
paramMargins_con=list(list(shape=2, scale=1),list(shape1=2, shape2=2)),
max_accrual_time = 5)
stat_t.plot(data, arm.name = c("A","B"),priority = c(1,2),
Ctime = seq(2,12,1),plotTimeUnit = "years",statistic = "WR", tau = 0,
stratum.weight = "unstratified", censoring_adjust = "No", plot_CI = TRUE)
#### An simulated example with three TTE endpoints.
data <- sim.data(n_trt = 200, n_con = 200, n_ep = 3, arm.name = c("A","B"),
ep_type = "tte", cdist.rate = 0.5, sim_method = "copula",
copula_trt=copula::normalCopula(param=c(0.9,0.8,0.95), dim = 3, dispstr = "un"),
margins_trt=c("gamma", "beta", "t"),
paramMargins_trt=list(list(shape=2, scale=1),list(shape1=2, shape2=2),list(df=5)),
copula_con=copula::normalCopula(param=c(0.9,0.8,0.95), dim = 3, dispstr = "un"),
margins_con=c("gamma", "beta", "t"),
paramMargins_con=list(list(shape=1, scale=1),list(shape1=2, shape2=3),list(df=5)),
max_accrual_time = 5)
stat_t.plot(data, arm.name = c("A","B"),priority = c(3,2,1),
Ctime = seq(1,8,0.5),plotTimeUnit = "years", statistic = "WR",
tau = 0, plot_CI = TRUE)