Learn R Programming

psychonetrics (version 0.17.8)

fit: Print fit indices

Description

This function will print all fit indices of the model. For the least-squares estimators with a mean-and-variance adjusted test ("DWLS"/"WLSMV") and for the robust maximum likelihood estimators ("MLM", "MLMV", "MLMVS", "MLR"; see setestimator), the printed measures additionally include the scaled test statistic (chisq.scaled, chisq.scaling.factor, df.scaled, and chisq.shift.parameters for the scaled-and-shifted variant) and, for robust ML, the robust fit indices (rmsea.robust, cfi.robust, tli.robust).

Usage

fit(x)

Value

Invisibly returns a data frame with fit measure estimates.

Arguments

x

A psychonetrics model.

Author

Sacha Epskamp

Examples

Run this code
# Load bfi data from psych package:
library("psychTools")
data(bfi)

# Also load dplyr for the pipe operator:
library("dplyr")

# Let's take the agreeableness items, and gender:
ConsData <- bfi %>% 
  select(A1:A5, gender) %>% 
  na.omit # Let's remove missingness (otherwise use Estimator = "FIML)

# Define variables:
vars <- names(ConsData)[1:5]

# Let's fit an empty GGM:
mod0 <- ggm(ConsData, vars = vars, omega = "zero")

# Run model:
mod0 <- mod0 %>% runmodel

# Inspect fit:
mod0 %>% fit # Pretty bad fit...

Run the code above in your browser using DataLab