Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandmaier/onyxr
Starting Onyx from R
https://github.com/brandmaier/onyxr
Last synced: about 14 hours ago
JSON representation
Starting Onyx from R
- Host: GitHub
- URL: https://github.com/brandmaier/onyxr
- Owner: brandmaier
- License: lgpl-3.0
- Created: 2016-12-06T10:53:24.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-11-02T19:46:16.000Z (about 3 years ago)
- Last Synced: 2023-10-20T18:27:39.573Z (about 1 year ago)
- Language: R
- Size: 124 KB
- Stars: 15
- Watchers: 5
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# onyxR
An R package for calling Onyx GUI from R when using OpenMx or lavaan packages for Structural Equation Modelling.
The package provides a simple onyx() function that takes either an OpenMx model or a lavaan model (either a
fitted lavaan model or string specification). If a local onyx executable is available, its path can be passed to the function.
Otherwise, it will attempt to download a copy of Onyx from the official repository. A recent version of
JAVA (version 1.6+) is required to be installed on the system.## Install
To install the onyxR package directly from GitHub, copy the following line into R:
```{r, eval=FALSE}
source('https://raw.githubusercontent.com/brandmaier/onyxR/master/tools/install.R')
```## Usage
Using onyxR is as simple as that. In lavaan
````{r, eval=FALSE}
HS.model <- ' visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 'fit <- cfa(HS.model, data = HolzingerSwineford1939)
summary(fit, fit.measures = TRUE)
onyx(fit)
````Alternatively, we can use onyxR to generate a path diagram for an OpenMx RAM-type model:
````{r, eval=FALSE}
data(demoOneFactor)
manifests <- names(demoOneFactor)
latents <- c("G")
factorModel <- mxModel("One Factor",
type="RAM",
manifestVars = manifests,
latentVars = latents,
mxPath(from=latents, to=manifests),
mxPath(from=manifests, arrows=2),
mxPath(from=latents, arrows=2,
free=FALSE, values=1.0),
mxData(cov(demoOneFactor), type="cov",
numObs=500))
fit <- mxRun(factorModel)onyx(fit)
````![openmx](https://github.com/brandmaier/onyxR/blob/master/inst/openmx-factor.png?raw=true)
## Demo
In a simple demo, we have wrapped the above example. We define the HS model with three independent factors in lavaan and pass this to Onyx to display the path diagram.
````{r, eval=FALSE}
require(onyxR)
demo(lavaanHS)
```