ggplot_sieve {sievePH} | R Documentation |
Plotting Univariate Mark-Specific Proportional Hazards Model Fits Using ggplot
Description
ggplot
-style plotting for univariate marks. Point and interval estimates of the mark-specific treatment effect parameter specified by component
contrast
in summary.sievePH
or summary.kernel_sievePH
are plotted, together with scatter and box plots of the observed mark values by treatment.
Usage
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)
)
Arguments
x |
an object returned by |
mark |
a numeric vector specifying a univariate continuous mark. For subjects with a right-censored time-to-event, the value(s) in |
tx |
a numeric vector indicating the treatment group (1 if treatment, 0 if placebo) |
xlim |
a numeric vector of length 2 specifying the x-axis range ( |
ylim |
a numeric vector of length 2 specifying the y-axis range ( |
xtickAt |
a numeric vector specifying the position of x-axis tickmarks ( |
xtickLab |
a numeric vector specifying labels for tickmarks listed in |
ytickAt |
a numeric vector specifying the position of y-axis tickmarks ( |
ytickLab |
a numeric vector specifying labels for tickmarks listed in |
tickLabSize |
a numeric value specifying the font size of tickmark labels along both axes in the bottom panel ( |
xlab |
a character string specifying the x-axis label ( |
ylab |
a character string specifying the y-axis label ( |
axisLabSize |
a numeric value specifying the font size of both axis labels in the bottom panel ( |
title |
a character string specifying the plot title ( |
titleSize |
a numeric value specifying the font size of the plot title ( |
subtitle |
a character string specifying the plot subtitle ( |
subtitleSize |
a numeric value specifying the font size of the plot subtitle ( |
txLab |
a character vector of length 2 specifying the placebo and treatment labels (in this order). The default labels are |
txLabSize |
a numeric value specifying the font size of labels |
legendLabSize |
a numeric value specifying the font size of legend labels in the bottom panel ( |
legendPosition |
a numeric vector of length 2 specifying the position of the legend in the bottom panel ( |
legendJustification |
a numeric vector of length 2 specifying the justification of the legend in the bottom panel ( |
estLineSize |
a numeric value specifying the line width for the point estimate of the mark-specific treatment effect ( |
ciLineSize |
a numeric value specifying the line width for the confidence limits for the mark-specific treatment effect ( |
boxplotWidth |
a numeric value specifying the width of each box in the box plot ( |
jitterFactor |
a numeric value specifying the amount of vertical jitter ( |
jitterSeed |
a numeric value setting the seed of R's random number generator for jitter in the scatter plot ( |
pointColor |
a character vector of length 2 color-coding the placebo and treatment group (in this order) in the scatter plot ( |
pointSize |
a numeric value specifying the size of data points in the scatter plot ( |
bottomPlotMargin |
a numeric vector, using cm as the unit, passed on to argument |
topPlotMargin |
a numeric vector, using |
plotHeights |
a numeric vector specifying relative heights of the top and bottom panels ( |
Value
A ggplot
object.
See Also
plot.summary.sievePH
, sievePH
, summary.sievePH
, kernel_sievePH
, summary.kernel_sievePH
Examples
n <- 200
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 using the sievePH method
fit1 <- sievePH(eventTime, eventInd, mark, tx)
sfit1 <- summary(fit1, markGrid=seq(markRng[1], markRng[2], length.out=10))
print(ggplot_sieve(sfit1, mark, tx))
# fit a model with a univariate mark using the kernel_sievePH method
fit2 <- kernel_sievePH(eventTime, eventInd, mark, tx,
tau = 3, tband = 0.5, hband = 0.3, nvgrid = 20,
nboot = NULL)
sfit2 <- summary(fit2)
print(ggplot_sieve(sfit2, mark, tx))