-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
50 lines (37 loc) · 1.64 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# GCLM
<!-- badges: start -->
<!-- badges: end -->
The goal of GCLM is to help you write lavaan() script for fitting generalized cross-lagged panel models (GCLM; Zyphur et al., 2019). Currently, there is only one function for fitting the base GCLM, but new functions and arguments may be added to automate the scripting of short-run Granger-Sims tests, and long-run impulse responses.
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("jsakaluk/GCLM")
```
## Example
This is a basic example which shows you how to solve a common problem:
```{r gclm scripting}
library(GCLM)
library(lavaan)
#Save/export script for GCLM between Sacrifice and Satisfaction over 5 waves
base.model <- gclm(xvar = "sacrifice", yvar = "satisfaction", waves = 5)
```
The function saves a lavaan() script for you to immediately submit to its model-fitting functions (e.g., lavaan::sem()), and also outputs a .txt document of the same script to the working directory.
![](figures/script.png)
```{r lavaan model fitting, eval=FALSE}
base.model.fit <- sem(base.model, data = dat)
summary(base.model.fit)
```
Eventually, new functionality may be programmed to automate the tests of short-run and long-run effects. Until then, users can manually ammend this script and save as a new lavaan() script to conduct these additional tests.