lines.icenReg_fit: Plotting for icenReg Fits

Description Usage Arguments Details Examples

View source: R/plottingFunctions.R

Description

Plotting for icenReg Fits

Usage

1
2
3
4
## S3 method for class 'icenReg_fit'
lines(x, y, newdata = NULL, fun = "surv",
  cis = F, ci_level = 0.9, survRange = c(0.025, 1),
  evalPoints = 20, ...)

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"

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.

...

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 # 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'))

Example output

Loading required package: survival
Loading required package: Rcpp
Loading required package: coda

icenReg documentation built on Oct. 23, 2020, 8:11 p.m.