ggplot
ggplot
-style plotting for univariate marks. Point and interval estimates of the mark-specific treatment effect parameter specified by component contrast
in summary.sievePH
are plotted, together with scatter and box plots of the observed mark values by treatment.
ggplot_sieve(
x,
mark = NULL,
tx = NULL,
xlim = NULL,
ylim = NULL,
xtickAt = NULL,
xtickLab = NULL,
ytickAt = NULL,
ytickLab = NULL,
tickLabSize = 14,
xlab = NULL,
ylab = NULL,
axisLabSize = 15,
title = NULL,
titleSize = 16,
subtitle = NULL,
subtitleSize = 10,
txLab = c("Placebo", "Treatment"),
txLabSize = 5,
legendLabSize = 12,
legendPosition = c(0.96, 1.08),
legendJustification = c(1, 1),
estLineSize = 1.6,
ciLineSize = 1.2,
boxplotWidth = 0.8,
jitterFactor = 0.1,
jitterSeed = 0,
pointColor = c("blue", "red3"),
pointSize = 1.7,
bottomPlotMargin = c(-0.5, 0.3, 0, 0),
topPlotMargin = c(0, 0.3, -0.12, 1.83),
plotHeights = c(0.33, 0.67)
)
A ggplot
object.
an object returned by summary.sievePH
a numeric vector specifying a univariate continuous mark. For subjects with a right-censored time-to-event, the value(s) in mark
should be set to NA
.
a numeric vector indicating the treatment group (1 if treatment, 0 if placebo)
a numeric vector of length 2 specifying the x-axis range (NULL
by default)
a numeric vector of length 2 specifying the y-axis range (NULL
by default)
a numeric vector specifying the position of x-axis tickmarks (NULL
by default)
a numeric vector specifying labels for tickmarks listed in xtickAt
. If NULL
(default), the labels are determined by xtickAt
.
a numeric vector specifying the position of y-axis tickmarks (NULL
by default)
a numeric vector specifying labels for tickmarks listed in ytickAt
. If NULL
(default), the labels are determined by ytickAt
.
a numeric value specifying the font size of tickmark labels along both axes in the bottom panel (14
by default)
a character string specifying the x-axis label (NULL
by default)
a character string specifying the y-axis label (NULL
by default)
a numeric value specifying the font size of both axis labels in the bottom panel (15
by default)
a character string specifying the plot title (NULL
by default)
a numeric value specifying the font size of the plot title (16
by default)
a character string specifying the plot subtitle (NULL
by default)
a numeric value specifying the font size of the plot subtitle (10
by default)
a character vector of length 2 specifying the placebo and treatment labels (in this order). The default labels are placebo
and treatment
.
a numeric value specifying the font size of labels txLab
(5
by default)
a numeric value specifying the font size of legend labels in the bottom panel (11
by default)
a numeric vector of length 2 specifying the position of the legend in the bottom panel (c(0.96, 1.08)
by default), passed on to argument legend.position
in theme()
a numeric vector of length 2 specifying the justification of the legend in the bottom panel (c(1, 1)
by default), passed on to argument legend.justification
in theme()
a numeric value specifying the line width for the point estimate of the mark-specific treatment effect (1.6
by default)
a numeric value specifying the line width for the confidence limits for the mark-specific treatment effect (1.2
by default)
a numeric value specifying the width of each box in the box plot (0.8
) by default
a numeric value specifying the amount of vertical jitter (0.1
by default)
a numeric value setting the seed of R's random number generator for jitter in the scatter plot (0
by default)
a character vector of length 2 color-coding the placebo and treatment group (in this order) in the scatter plot (c("blue", "red3")
by default)
a numeric value specifying the size of data points in the scatter plot (1.7
by default)
a numeric vector, using cm as the unit, passed on to argument plot.margin
in theme()
for the bottom panel (c(-0.5, 0.3, 0, 0)
by default)
a numeric vector, using "lines"
as the unit, passed on to argument plot.margin
in theme()
for the top panel (c(0, 0.3, -0.12, 1.83)
by default)
a numeric vector specifying relative heights of the top and bottom panels (c(0.33, 0.67)
by default) passed on to argument heights
in ggpubr::ggarrange()
plot.summary.sievePH
, sievePH
and summary.sievePH
n <- 500
tx <- rep(0:1, each=n/2)
tm <- c(rexp(n/2, 0.2), rexp(n/2, 0.2 * exp(-0.4)))
cens <- runif(n, 0, 15)
eventTime <- pmin(tm, cens, 3)
eventInd <- as.numeric(tm <= pmin(cens, 3))
mark <- ifelse(eventInd==1, c(rbeta(n/2, 2, 5), rbeta(n/2, 2, 2)), NA)
markRng <- range(mark, na.rm=TRUE)
# fit a model with a univariate mark
fit <- sievePH(eventTime, eventInd, mark, tx)
sfit <- summary(fit, markGrid=seq(markRng[1], markRng[2], length.out=10))
print(ggplot_sieve(sfit, mark, tx))
Run the code above in your browser using DataLab