nice_sem.RdThis function takes an object returned from the lavaan package's sem or cfa functions and produces a nicely formatted HTML table summarizing the model parameters and fit measures. It allows customization of displayed columns, inclusion of confidence intervals, and choice between standardized and unstandardized estimates.
nice_sem(
x,
standardized = TRUE,
show_fitmeasures = c(CFI = "cfi", TLI = "tli", RMSEA = "rmsea", `RMSEA ci lower` =
"rmsea.ci.lower", SRMR = "srmr", AIC = "aic", BIC = "bic"),
remove_cols = NULL,
show_ci = TRUE,
round = 2,
...
)An object returned from the lavaan sem or cfa function.
If TRUE, standardized estimates are shown.
A named vector with fit measures.
Either column number or column names to be removed.
If TRUE, adds columns with 95% confidence intervals.
Number of digits to round numeric values.
Further arguments passed to the nice_table() function.
An HTML table summarizing the structure equation model.
The function organizes the output into sections for latent variables, regressions, covariances
, variances, and intercepts. It also appends key fit measures at the end of the table.
Users can specify which columns to remove, whether to show confidence intervals, and whether to display standardized estimates.
It leverages the nice_table() function for final formatting, allowing further customization through additional arguments.
The resulting table includes a title and footnote that provide context about the estimation method, optimization algorithm, handling of missing data, and citation information for the lavaan package.
nice_sem(lavaan_fit)
Table
Structure equation model
lower
upper
Latent variables
Covariances
Variances
Intercepts
Modelfit
Note. The estimation method employed in this analysis is Maximum Likelihood (ML). The Non-Linear Minimization, Bounded (nlminb) algorithm was applied for optimization. Missing data were addressed using the Full Information Maximum Likelihood (FIML) approach. The analysis was performed with the lavaan package in R (Yves Rosseel, Terrence D. Jorgensen, Luc De Wilde, 2025).
nice_sem(lavaan_fit, standardized = FALSE, show_ci = FALSE)
Table
Structure equation model
parameter
est
se
z
p
Latent variables
Covariances
Variances
Intercepts
Modelfit
Note. The estimation method employed in this analysis is Maximum Likelihood (ML). The Non-Linear Minimization, Bounded (nlminb) algorithm was applied for optimization. Missing data were addressed using the Full Information Maximum Likelihood (FIML) approach. The analysis was performed with the lavaan package in R (Yves Rosseel, Terrence D. Jorgensen, Luc De Wilde, 2025).
nice_sem(
lavaan_fit,
show_fitmeasures = c(
FI = "cfi", TLI = "tli", RMSEA = "rmsea",
"SRMR" = "srmr"
),
remove_cols = c("se", "z")
)
Table
Structure equation model
lower
upper
Latent variables
Covariances
Variances
Intercepts
Modelfit
Note. The estimation method employed in this analysis is Maximum Likelihood (ML). The Non-Linear Minimization, Bounded (nlminb) algorithm was applied for optimization. Missing data were addressed using the Full Information Maximum Likelihood (FIML) approach. The analysis was performed with the lavaan package in R (Yves Rosseel, Terrence D. Jorgensen, Luc De Wilde, 2025).