Learn R Programming

smcfcs (version 1.7.1)

plot.smcfcs: Assess convergence of a smcfcs object

Description

Visualises the contents of smCoefIter. Specifically, it plots the parameter estimates of the substantive model against the number of iterations from the imputation procedure. This is done for each regression coefficient, and each line corresponds to an imputed dataset.

Usage

# S3 method for smcfcs
plot(x, include = "all", ...)

Value

A ggplot2 object, containing the convergence plots, facetted per covariate in the substantive model

Arguments

x

An object of class 'smcfcs'

include

Character vector of coefficient names for which to return the convergence plot. Default is "all" and returns plots for all coefficients in a facetted manner.

Recommendation is to plot first with include = "all", and then select coefficient names to zoom in to.

For competing risks, the coefficients are indexed by their cause. E.g. for coefficient of a variable x1 in a model for cause 2, will be labelled "x1-cause2".

...

Additional parameters to pass on to ggplot2::facet_wrap(), eg. nrow = 2

Author

Edouard F. Bonneville e.f.bonneville@lumc.nl

Details

Requires loading of ggplot2 plotting library.

Examples

Run this code
if (FALSE) {
# Use simulated competing risks example in package
imps <- smcfcs(
originaldata = ex_compet,
smtype = "compet",
smformula = list(
"Surv(t, d == 1) ~ x1 + x2",
"Surv(t, d == 2) ~ x1 + x2"
),
method = c("", "", "norm", "norm")
)

plot(imps)
plot(imps, include = c("x1-cause1", "x2-cause2"))
}

Run the code above in your browser using DataLab