Learn R Programming

lavaan (version 0.5-14)

lavTables: lavaan Tables

Description

Pairwise tables for categorical variables.

Usage

lavTables(object, dimension = 2L, categorical = NULL, std.resid = TRUE, 
          min.std.resid = 0.0, average = FALSE, collapse = FALSE)

Arguments

object
Either a data.frame, or an object of class lavaan.
dimension
Integer. If 1L, compute one-dimensional tables; if 2L compute two-dimensional (pairwise) tables.
categorical
Only used if object is a data.frame. Specify variables that need to be treated as categorical.
std.resid
If TRUE and object is a lavaan object, add a column containing the standardized residuals per cell (see equation 35 in the reference).
min.std.resid
Numeric. If larger than zero, show only those cells which have a standardized residual larger than min.std.resid.
average
If TRUE, add columns for the average standardized residual per table (str.average), and for the number (str.nlarge) and proportion (str.plarge) of cells for which the standardized residual is larger tha
collapse
Either a logical, or the string "matrix". If TRUE, only one row per table is shown. If "matrix", the output is a symmetric matrix; the elements of the matrix are the standardized residuals per pairwise table.

Value

  • If collapse = FALSE, a data.frame where each row corresponds to a cell of a pairwise table. If collapse = TRUE, the data.frame contains only one row per table. If collapse = "matrix", a symmetric matrix where the elements are the values for the standardized residual for each pairwise table.

References

Joreskog, K.G. & Moustaki, I. (2001). Factor analysis of ordinal variables: A comparison of three approaches. Multivariate Behavioral Research, 36, 347-387.

See Also

varTable.

Examples

Run this code
HS9 <- HolzingerSwineford1939[,c("x1","x2","x3","x4","x5",
                                 "x6","x7","x8","x9")]
HSbinary <- as.data.frame( lapply(HS9, cut, 2, labels=FALSE) )
HS.model <- ' visual  =~ x1 + x2 + x3
              textual =~ x4 + x5 + x6
              speed   =~ x7 + x8 + x9 '

fit <- cfa(HS.model, data=HSbinary, ordered=names(HSbinary))
lavTables(fit, min.std.resid=1.0)
lavTables(fit, collapse="matrix")

Run the code above in your browser using DataLab