ggplot_sieve: Plotting Univariate Mark-Specific Proportional Hazards Model...

View source: R/ggplot_sieve.R

ggplot_sieveR 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 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 summary.sievePH

mark

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.

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 (NULL by default)

ylim

a numeric vector of length 2 specifying the y-axis range (NULL by default)

xtickAt

a numeric vector specifying the position of x-axis tickmarks (NULL by default)

xtickLab

a numeric vector specifying labels for tickmarks listed in xtickAt. If NULL (default), the labels are determined by xtickAt.

ytickAt

a numeric vector specifying the position of y-axis tickmarks (NULL by default)

ytickLab

a numeric vector specifying labels for tickmarks listed in ytickAt. If NULL (default), the labels are determined by ytickAt.

tickLabSize

a numeric value specifying the font size of tickmark labels along both axes in the bottom panel (14 by default)

xlab

a character string specifying the x-axis label (NULL by default)

ylab

a character string specifying the y-axis label (NULL by default)

axisLabSize

a numeric value specifying the font size of both axis labels in the bottom panel (15 by default)

title

a character string specifying the plot title (NULL by default)

titleSize

a numeric value specifying the font size of the plot title (16 by default)

subtitle

a character string specifying the plot subtitle (NULL by default)

subtitleSize

a numeric value specifying the font size of the plot subtitle (10 by default)

txLab

a character vector of length 2 specifying the placebo and treatment labels (in this order). The default labels are placebo and treatment.

txLabSize

a numeric value specifying the font size of labels txLab (5 by default)

legendLabSize

a numeric value specifying the font size of legend labels in the bottom panel (11 by default)

legendPosition

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()

legendJustification

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()

estLineSize

a numeric value specifying the line width for the point estimate of the mark-specific treatment effect (1.6 by default)

ciLineSize

a numeric value specifying the line width for the confidence limits for the mark-specific treatment effect (1.2 by default)

boxplotWidth

a numeric value specifying the width of each box in the box plot (0.8) by default

jitterFactor

a numeric value specifying the amount of vertical jitter (0.1 by default)

jitterSeed

a numeric value setting the seed of R's random number generator for jitter in the scatter plot (0 by default)

pointColor

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)

pointSize

a numeric value specifying the size of data points in the scatter plot (1.7 by default)

bottomPlotMargin

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)

topPlotMargin

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)

plotHeights

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()

Value

A ggplot object.

See Also

plot.summary.sievePH, sievePH and summary.sievePH

Examples

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))


sievePH documentation built on Feb. 16, 2023, 9:55 p.m.