autoplot.ate: Plot Average Risks

Description Usage Arguments See Also Examples

View source: R/autoplot.ate.R

Description

Plot average risks.

Usage

1
2
3
## S3 method for class 'ate'
autoplot(object, ci = FALSE, band = FALSE, plot = TRUE,
  digits = 2, alpha = NA, ...)

Arguments

object

Object obtained with the function ate.

ci

[logical] If TRUE display the confidence intervals for the average risks.

band

[logical] If TRUE display the confidence bands for the average risks.

plot

[logical] Should the graphic be plotted.

digits

[integer, >0] Number of decimal places.

alpha

[numeric, 0-1] Transparency of the confidence bands. Argument passed to ggplot2::geom_ribbon.

...

not used. Only for compatibility with the plot method.

See Also

ate to compute average risks.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(survival)
library(rms)

#### simulate data ####
n <- 1e2
set.seed(10)
dtS <- sampleData(n,outcome="survival")


#### Cox model ####
fit <- cph(formula = Surv(time,event)~ X1+X2,data=dtS,y=TRUE,x=TRUE)

#### Average treatment effect ####
seqTimes <- sort(unique(fit$y[,1]))
seqTimes5 <- seqTimes[seqTimes>5 & seqTimes<10]
ateFit <- ate(fit, data = dtS, treatment = "X1", contrasts = NULL,
              times = seqTimes, B = 0, band = TRUE, nsim.band = 500, y = TRUE,
              mc.cores=1)

#### display #### 
autoplot(ateFit)

outGG <- autoplot(ateFit, band = TRUE, ci = TRUE, alpha = 0.1)
dd <- as.data.frame(outGG$data[Treatment == 0])
outGG$plot + facet_wrap(~Treatment, labeller = label_both)

riskRegression documentation built on Oct. 5, 2018, 1:03 a.m.