-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
73 lines (50 loc) · 2.59 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# simstandard <a href="https://wjschne.github.io/simstandard/"><img src="man/figures/logo.png" align="right" height="120" /></a>
<!-- badges: start -->
[![R-CMD-check](https://github.com/wjschne/simstandard/workflows/R-CMD-check/badge.svg)](https://github.com/wjschne/simstandard/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/simstandard)](https://CRAN.R-project.org/package=simstandard)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![Codecov test coverage](https://codecov.io/gh/wjschne/simstandard/branch/main/graph/badge.svg)](https://app.codecov.io/gh/wjschne/simstandard?branch=main)
[![R-CMD-check](https://github.com/wjschne/simstandard/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/wjschne/simstandard/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
Sometimes you have a structural model with standardized path coefficients, structural coefficients, and correlations, but you do not know the error and disturbance variances. The purpose of `simstandard` is to calculate these variances and then simulate multivariate normal data based on your model.
## Installation
You can either install simstandard from CRAN or install the development version of simstandard from github.
### Option 1: Install the most recent stable release from CRAN
You can install simstandard from CRAN by running this code:
```{r, eval = FALSE}
install.packages("simstandard")
```
### Option 2: Install the development version from GitHub
To install the development version of simstandard, you need to check if the remotes packages is installed. If not, run this:
```{r, eval = FALSE}
install.packages("remotes")
```
Once you are sure you have the remotes package installed, you can install the development version of simstandard from GitHub by running this code:
```{r, eval = FALSE}
remotes::install_github("wjschne/simstandard")
```
## Example
The `simstandard` package uses [lavaan syntax](https://lavaan.ugent.be/tutorial/syntax1.html) to specify models.
```{r example}
library(simstandard)
model <- "
A =~ 0.5 * A1 + 0.8 * A2
B =~ 0.6 * B1 + 0.7 * B2
B ~ 0.8 * A
C ~~ 0.5 * A
"
data <- sim_standardized(m = model, n = 500)
knitr::kable(head(data), digits = 2)
```
See more in the [tutorial for this package](https://wjschne.github.io/simstandard//articles/simstandard_tutorial.html).