plot.eval_squant {squant} | R Documentation |
Plot eval_squant result
Description
plot
plots the subgroup identification performance.
Usage
## S3 method for class 'eval_squant'
plot(x, trt.name = "Trt", ctrl.name = "Ctrl", ...)
Arguments
x |
An eval_squant object. The output of |
trt.name |
The name used on plot for the treatment arm. |
ctrl.name |
The name used on plot for the control arm. |
... |
Ignored. |
Details
An interaction plot is plotted for the predictive case and a group plot is plotted for the prognostic case.
Value
A ggplot.
Examples
#toy example#
set.seed(888)
x=as.data.frame(matrix(rnorm(200),100,2))
names(x) = c("x1", "x2")
trt = sample(0:1, size=100, replace=TRUE)
y= 2*x[,2]*trt+rnorm(100)
data = cbind(y=y, trt=trt, x)
res = squant(yvar="y", censorvar=NULL, xvars=c("x1", "x2"),
trtvar="trt", trtcd=1, data=data, type="c", weight=NULL,
dir="larger", quant=NULL, xvars.keep=NULL, alpha=1,
fold=2, n.cv = 10, FDR = 0.1, progress=FALSE)
#predictive case with continuous response#
set.seed(888)
x=as.data.frame(matrix(rnorm(20000),200,100))
names(x) = paste("x", 1:100,sep="")
trt = sample(0:1, size=200, replace=TRUE)
y=x[,1]+x[,2]*trt+rnorm(200)
data = cbind(y=y, trt=trt, x)
res = squant(yvar="y", censorvar=NULL, xvars=paste("x", 1:100,sep=""),
trtvar="trt", trtcd=1, data=data, type="c", weight=NULL,
dir="larger", quant=NULL, xvars.keep=NULL, alpha=1,
fold=5, n.cv = 50, FDR = 0.1)
res
#fitted signature#
res$squant.fit
#performance of the identified subgroup#
#including:
# interaction p value,
# p valve of trt difference in positive group,
# p value of trt difference in negative group,
# and stats for each arm in each group.
res$performance
#interpretation#
res$interpretation1
res$interpretation2
#evaluation of prediction performance#
eval.res = eval_squant(yvar="y", censorvar=NULL, trtvar="trt", trtcd=1, dir="larger",
type="c", data=data, squant.out=res, brief=FALSE)
#plot the subgroups#
plot(res, trt.name="Trt", ctrl.name="Ctrl")
plot(eval.res, trt.name="Trt", ctrl.name="Ctrl")
#prognostic case with survival response#
set.seed(888)
x=as.data.frame(matrix(rnorm(20000),200,100))
names(x) = paste("x", 1:100,sep="")
y=10*(10+x[,1]+rnorm(200))
data = cbind(y=y, x)
data$event = sample(c(rep(1,150),rep(0,50)))
res = squant(yvar="y", censorvar="event", xvars=paste("x", 1:100,sep=""),
trtvar=NULL, trtcd=NULL, data=data, type="s", weight=NULL,
dir="larger", quant=NULL, xvars.keep=NULL, alpha=1,
fold=5, n.cv = 50, FDR = 0.1)
res
#fitted signature#
res$squant.fit
#performance of the identified subgroup#
res$performance
#evaluation of prediction performance#
eval.res = eval_squant(yvar="y", censorvar="event", trtvar=NULL, trtcd=NULL, dir="larger",
type="s", data=data, squant.out=res, brief=FALSE)
#plot the subgroups#
plot(res, trt.name=NULL, ctrl.name=NULL)
plot(eval.res, trt.name=NULL, ctrl.name=NULL)
[Package squant version 1.1.5 Index]