Learn R Programming

ctsem (version 3.10.3)

ctFitCovCheck: Visual model-fit diagnostics for ctsem fits, optionally split by the mean of a chosen observed variable.

Description

Visual model-fit diagnostics for ctsem fits, optionally split by the mean of a chosen observed variable.

Usage

ctFitCovCheck(fit, cor = FALSE, plot = TRUE, splitby = NULL)

Value

Either a plot/list of plots (default, given by `plot.ctFitCovCheck`) or a `data.table`.

Arguments

fit

A `ctStanFit` object.

cor

Logical; if `TRUE` correlations are analysed instead of covariances.

plot

Logical; if `TRUE` (default) a `ggplot2` object (or list of plots) is returned. If `FALSE`, the raw `data.table` with diagnostics is returned.

splitby

Optional character string giving the variable name on which to split subjects.

Examples

Run this code
# \donttest{
ctFitCovCheck(ctstantestfit, cor = TRUE, plot = TRUE)

gg=ctFitCovCheck(ctstantestfit, cor = FALSE, plot = TRUE, splitby = "TI1")
print(gg[[1]]+
ggplot2::ggtitle("Covariance Check for Y1 with all other manifest variables, split by TI1"))
# }

Run the code above in your browser using DataLab