plot.smcfcs: Assess convergence of a smcfcs object

View source: R/plot_convergence.R

plot.smcfcsR Documentation

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 class 'smcfcs'
plot(x, include = "all", ...)

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

Details

Requires loading of ggplot2 plotting library.

Value

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

Author(s)

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

Examples

## Not run: 
# 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"))

## End(Not run)


smcfcs documentation built on Nov. 10, 2022, 6:18 p.m.