-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
77 lines (62 loc) · 3.15 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
output:
github_document:
html_preview: true
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
```{r, include = FALSE, cache = TRUE}
library("semTests")
set.seed(313)
model <- "A =~ A1+A2+A3+A4+A5;
C =~ C1+C2+C3+C4+C5"
n <- 200
object <- lavaan::sem(model, psych::bfi[1:n, 1:10], estimator = "MLM")
options(warn = -1)
```
# semTests <img src="man/figures/logo.png" align="right" width="210" height="130" />
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/semTests)](https://cran.r-project.org/package=semTests)
[![R-CMD-check](https://github.com/JonasMoss/semTests/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/JonasMoss/semTests/actions/workflows/R-CMD-check.yaml)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
An R package for goodness of fit testing of structural equation models. Built on top of `lavaan`. Implements the *p*-values of (Foldnes, Moss, Grønneberg, 2024).
```{r setup, include=FALSE}
# library("semTests")
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(out.width = "750px", dpi = 200)
```
## Installation¨
Either install from `CRAN`,
```{r, eval = FALSE}
install.packages("semTests")
```
Or install the development version using the following command inside `R`:
```{r install, echo = TRUE, eval = FALSE}
# install.packages("remotes")
remotes::install_github("JonasMoss/semTests")
```
## Usage
Call the `library` function, create a `lavaan` model, and run the
`pvalues` function.
```{r prepare, echo = TRUE, eval = TRUE}
library("semTests")
model <- "A =~ A1+A2+A3+A4+A5;
C =~ C1+C2+C3+C4+C5"
n <- 200
object <- lavaan::sem(model, psych::bfi[1:n, 1:10], estimator = "MLM")
pvalues(object)
```
## References
Foldnes, N., Moss, J., & Grønneberg, S. (2024). Improved goodness of fit procedures for structural equation models. Structural Equation Modeling: A Multidisciplinary Journal, 1–13. https://doi.org/10.1080/10705511.2024.2372028
Foldnes, N., & Grønneberg, S. (2018). Approximating Test Statistics Using Eigenvalue Block Averaging. Structural Equation Modeling, 25(1), 101–114. https://doi.org/10.1080/10705511.2017.1373021
Grønneberg, S., & Foldnes, N. (2019). Testing Model Fit by Bootstrap Selection. Structural Equation Modeling, 26(2), 182–190. https://doi.org/10.1080/10705511.2018.1503543
Marcoulides, K. M., Foldnes, N., & Grønneberg, S. (2020). Assessing Model Fit in Structural Equation Modeling Using Appropriate Test Statistics. Structural Equation Modeling, 27(3), 369–379. https://doi.org/10.1080/10705511.2019.1647785
Rosseel, Y. (2012). lavaan: An R package for structural equation modeling.
Journal of Statistical Software, 48(2), 1–36. https://doi.org/10.18637/jss.v048.i02
## How to Contribute or Get Help
If you encounter a bug, have a feature request or need some help, open a [Github issue](https://github.com/JonasMoss/semTests/issues). Create a pull requests to contribute.