plot.icenReg_fit {icenReg}R Documentation

Plotting for icenReg Fits

Description

Plotting for icenReg Fits

Usage

## S3 method for class 'icenReg_fit'
plot(
  x,
  y,
  newdata = NULL,
  fun = "surv",
  plot_legend = T,
  cis = T,
  ci_level = 0.9,
  survRange = c(0.025, 1),
  evalPoints = 200,
  lgdLocation = lgd_default(fun),
  xlab = "time",
  ...
)

Arguments

x

icenReg fit

y

new data.frame

newdata

new data.frame (ignored if y is included)

fun

Function to be plotted. Options include "surv" or "cdf"

plot_legend

Should legend be plotted?

cis

Should confidence/credible interval be plotted?

ci_level

Confidence/credible interval

survRange

Range of survival curve to be plotted

evalPoints

Number of evaluations of survival curve to be plotted.

lgdLocation

Location of legend; see ?legend for options

xlab

Label of x-axis

...

additional arguments to be passed to the base plot function

Details

Plots survival function from either an ic_np, ic_sp, ic_par or ic_bayes object. If newdata is NULL, the baseline distribution is plotted. Otherwise, newdata should be a data.frame with each row containing a set covariates for which the fit will be plotted. If multiple rows are included, the lines will be colored and a legend will be created using the rownames of newdata.

For ic_np and ic_sp, the MLE is plotted with no intervals (at the time of writing this, there is no formula for standard errors of baseline distributions for these methods).

For ic_par and ic_bayes, the output plotted is directly extracted from survCIs.

If the argument col is provided, it will be used to color each survival function in order of the rows provided in newdata.

Examples

 # Fitting mice data set
 data(miceData)
 miceFit <- ic_par(cbind(l, u) ~ grp, data = miceData) 
 
 # Creating covariates we want plotted
 newData <- data.frame(grp = c("ce", "ge"))
 # Naming rows for legend
 rownames(newData) <- c("Conventional", "Germ-Free")
 
 plot(miceFit, newdata = newData, 
      col = c('blue', 'orange'))

[Package icenReg version 2.0.16 Index]