View source: R/plottingFunctions.R
plot.icenReg_fit | R Documentation |
Plotting for icenReg Fits
## 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",
...
)
x |
icenReg fit |
y |
new data.frame |
newdata |
new data.frame (ignored if |
fun |
Function to be plotted. Options include |
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 |
xlab |
Label of x-axis |
... |
additional arguments to be passed to the base |
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
.
# 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'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.