Learn R Programming

SEMdeep

Structural Equation Modeling with Deep Neural Network and Machine Learning

SEMdeep train and validate a custom (or data-driven) structural equation model (SEM) using layer-wise deep neural networks (DNNs) or node-wise machine learning (ML) algorithms. SEMdeep comes with the following functionalities:

  • Automated ML or DNN model training based on SEM network structures.

  • Network plot representation as interpretation diagram.

  • Model performance evaluation through regression and classification metrics.

  • Model variable importance computation through Shapley (R2) values, Gradient (or Connection) weight approach and significance tests of network inputs.

Installation

SEMdeep uses the deep learning framework 'torch'. The torch package is native to R, so it's computationally efficient, as there is no need to install Python or any other API, and DNNs can be trained on CPU, GPU and MacOS GPUs. Before using 'SEMdeep' make sure that the current version of ‘torch’ is installed and running:

install.packages("torch")

library(torch)

install_torch(reinstall = TRUE)

Only for windows (not Linux or Mac). Some Windows distributions don’t have the Visual C++ runtime pre-installed, download from Microsoft VC_redist.x86.exe (R32) or VC_redist.x86.exe (R64) and install it.

For GPU setup, or if you have problems installing torch package, check out the installation help from the torch developer.

Then, the latest stable version can be installed from CRAN:

install.packages("SEMdeep")

The latest development version can be installed from GitHub:

# install.packages("devtools")
devtools::install_github("BarbaraTarantino/SEMdeep")

Getting help

The full list of SEMdeep functions with examples is available at our website HERE.

Copy Link

Version

Install

install.packages('SEMdeep')

Monthly Downloads

189

Version

1.0.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Barbara Tarantino

Last Published

January 23rd, 2025

Functions in SEMdeep (1.0.0)

predict.ML

SEM-based out-of-sample prediction using node-wise ML
predict.SEM

SEM-based out-of-sample prediction using layer-wise ordering
nplot

Create a plot for a neural network model
predict.DNN

SEM-based out-of-sample prediction using layer-wise DNN
getConnectionWeight

Connection Weight method for neural network variable importance
getShapleyR2

Compute variable importance using Shapley (R2) values
mapGraph

Map additional variables (nodes) to a graph object
getGradientWeight

Gradient Weight method for neural network variable importance
SEMml

Nodewise SEM train using Machine Learning (ML)
getSignificanceTest

Test for the significance of neural network inputs
getVariableImportance

Variable importance for Machine Learning models
classificationReport

Prediction evaluation report of a classification model
crossValidation

Cross-validation of linear SEM, ML or DNN training models
SEMdnn

Layer-wise SEM train with a Deep Neural Netwok (DNN)