ctFitCovCheck: Visual model-fit diagnostics for ctsem fits, optionally split...

View source: R/ctCheckFit.R

ctFitCovCheckR Documentation

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)

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.

Value

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

Examples


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"))


ctsem documentation built on June 21, 2025, 5:08 p.m.