https://github.com/mikewlcheung/symsem
Symbolic Computation for Structural Equation Models
https://github.com/mikewlcheung/symsem
caracas r-package structural-equation-modeling symbolic-calculations
Last synced: 3 months ago
JSON representation
Symbolic Computation for Structural Equation Models
- Host: GitHub
- URL: https://github.com/mikewlcheung/symsem
- Owner: mikewlcheung
- Created: 2020-07-02T08:14:31.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-17T12:51:26.000Z (about 2 years ago)
- Last Synced: 2025-12-09T11:43:49.352Z (6 months ago)
- Topics: caracas, r-package, structural-equation-modeling, symbolic-calculations
- Language: R
- Homepage:
- Size: 42 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS
Awesome Lists containing this project
README
[](https://github.com/mikewlcheung/symsem/actions)
[](https://cran.r-project.org/package=symSEM)
[](https://cranlogs.r-pkg.org/badges/symSEM)
[](https://cranlogs.r-pkg.org/badges/grand-total/symSEM)
[](https://www.rdocumentation.org/packages/symSEM)
# symSEM
Symbolic Computation for Structural Equation Models
The symSEM package uses the [caracas](https://cran.r-project.org/package=caracas) package, which depends on the [SymPy](https://www.sympy.org/) library, for the symbolic computations.
The stable version can be installed from CRAN by:
```
install.packages("symSEM")
```
The developmental version can be installed from GitHub by:
```
## Install remotes package if it has not been installed yet
# install.packages("remotes")
remotes::install_github("mikewlcheung/symsem")
```
# Example
## Compute a symbolic model-implied covariance and correlation matrices
```
library(symSEM)
## A regression model
model <- "y ~ b1*x1 + b2*x2
## Covariance between x1 and x2
x1 ~~ x2
## Means
y ~ b0*1
x1 ~ m1*1
x2 ~ m2*1"
## Convert it into a RAM speculation
RAM <- metaSEM::lavaan2RAM(model)
## Implied covariance matrix and mean structure
impliedS(RAM, corr=FALSE)
## Implied correlation matrix
impliedS(RAM, corr=TRUE)
```