tmsalab / pathmodelfit

Fit Indices for the Path Component of Latent Variable Structural Equation Models

Home Page:https://tmsalab.github.io/pathmodelfit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pathmodelfit

R build status Package-License

The goal of pathmodelfit is to provide fit indices for the path components of latent variable Structural Equation Models (SEM).

Installation

You can install the released version of pathmodelfit from CRAN with:

install.packages("pathmodelfit")

Or, you can be on the cutting-edge development version on GitHub using:

if(!requireNamespace("remotes")) { install.packages("remotes") }
remotes::install_github("tmsalab/pathmodelfit")

Usage

To use pathmodelfit, load the package using:

library("pathmodelfit")

From there, load the data, setup the path and obtain a lavaan model.

# Load example data
data(mediationVC, package = "pathmodelfit")

# Define path model for lavaan
model4 <- "
Ldrrew =~ LdrrewI1 + LdrrewI2 + LdrrewI3
Jobcom =~ JobcomI1 + JobcomI2 + JobcomI3
Jobsat =~ JobsatI1 + JobsatI2 + JobsatI3
Orgcom =~ OrgcomI1 + OrgcomI2 + OrgcomI3
Jobsat ~ Ldrrew + Jobcom
Orgcom ~ Jobsat"

# Fit the pathmodel with lavaan's sem() function
fit <- lavaan::sem(model4, sample.cov = mediationVC, sample.nobs = 232)

Then, the fit indices can be estimated using:

# Compute the fit indices
pathmodelfit_info = pathmodelfit(fit)

# View results
pathmodelfit_info
#>                             Est
#> RMSEA-P                 0.14685
#> RMSEA-P 90% lower bound 0.04543
#> RMSEA-P 90% upper bound 0.21931
#> NSCI-P                  0.95587
#> srmr.s                  0.05526
#> rmsea.s                 0.17376
#> tli.s                   0.88764
#> cfi.s                   0.95506

Authors

Steven Andrew Culpepper and Larry Williams

Citing the pathmodelfit package

To ensure future development of the package, please cite pathmodelfit package if used during an analysis or simulation study. Citation information for the package may be acquired by using in R:

citation("pathmodelfit")

License

GPL (>= 2)

About

Fit Indices for the Path Component of Latent Variable Structural Equation Models

https://tmsalab.github.io/pathmodelfit


Languages

Language:R 93.2%Language:TeX 6.8%