Learn R Programming

psychonetrics (version 0.15)

write_psychonetrics: Write comprehensive model output to a text file

Description

Writes a comprehensive plain-text output file containing all model information, similar to Mplus or LISREL output. The file includes model specification, sample information, parameter estimates, fit measures, model matrices, modification indices, and the model logbook. This file can be shared as supplementary material in publications.

Usage

write_psychonetrics(x, file = "psychonetrics_output.txt",
                    matrices = TRUE, MIs = TRUE, logbook = TRUE)

Value

Invisibly returns the file path of the written output.

Arguments

x

A psychonetrics model.

file

Character string specifying the path to the output file. Defaults to "psychonetrics_output.txt".

matrices

Logical. Should the full estimated model matrices be included in the output? Defaults to TRUE. Set to FALSE for more compact output.

MIs

Logical. Should modification indices be included? Only included if modification indices have been computed via addMIs. Defaults to TRUE.

logbook

Logical. Should the model logbook be included? Defaults to TRUE.

Author

Sacha Epskamp

Examples

Run this code
# \donttest{
library("dplyr")

# Load data:
data(StarWars)

# Simple CFA:
Lambda <- matrix(1, 4)
mod <- lvm(StarWars, lambda = Lambda, vars = c("Q1","Q5","Q6","Q7"),
           identification = "variance", latents = "Originals")
mod <- mod %>% runmodel %>% addfit

# Write output:
write_psychonetrics(mod, file = tempfile(fileext = ".txt"))
# }

Run the code above in your browser using DataLab