Learn R Programming

⚠️There's a newer version (1.6.0) of this package.Take me there.

Dynamic structural equation models

Package dsem fits dynamic structural equation models, which includes as nested submodels:

  1. structural equation models
  2. vector autoregressive models
  3. dynamic factor analysis
  4. state-space autoregressive integrated moving average (ARIMA) models

The model has several advantages:

  • It estimates direct, indirect, and total effects among system variables, including simultaneous and lagged effects and recursive (cyclic) dependencies
  • It can estimate the cumulative outcome from press or pulse experiments or initial conditions that differ from the stationary distribution of system dynamics
  • It estimates structural linkages as regression slopes while jointly imputing missing values and/or measurement errors
  • It is rapidly fitted as a Gaussian Markov random field (GMRF) in a Generalized Linear Mixed Model (GLMM), with speed and asymptotics associated with each
  • It allows granular control over the number of parameters (and restrictions on parameters) used to structure the covariance among variables and over time,

dsem is specifically intended as a minimal implementation, and uses standard packages to simplify input/output formatting:

  • Input: time-series defined using class ts, with NA for missing values
  • Input: structural trade-offs specified using syntax defined by package sem
  • Output: visualizing estimated trade-offs using igraph
  • Output: access model output using standard S3-generic functions including summary, predict, residuals, simulate, and AIC

Please see package vignettes for more details regarding syntax and features.

Citation

Thorson, J. T., Andrews, A. G., Essington, T., & Large, S. (2024). Dynamic structural equation models synthesize ecosystem dynamics constrained by ecological mechanisms. Methods in Ecology and Evolution 15(4): 744-755. https://doi.org/10.1111/2041-210X.14289

Copy Link

Version

Install

install.packages('dsem')

Monthly Downloads

459

Version

1.5.0

License

GPL-3

Maintainer

James Thorson

Last Published

February 13th, 2025

Functions in dsem (1.5.0)

read_model

Make a RAM (Reticular Action Model)
print.dsem

Print fitted dsem object
vcov.dsem

Extract Variance-Covariance Matrix
total_effect

Calculate total effects
test_dsep

Test d-separation
stepwise_selection

Simulate dsem
summary.dsem

summarize dsem
sea_otter

Sea otter trophic cascade
simulate.dsem

Simulate dsem
residuals.dsem

Calculate residuals
cAIC

Calculate conditional AIC
dsem_control

Detailed control for dsem structure
bering_sea

Bering Sea marine ecosystem
convert_equations

Convert equations notation
dsem

Fit dynamic structural equation model
as_fitted_DAG

Convert output from package dsem to phylopath
classify_variables

Classify variables path
TMBAIC

Calculate marginal AIC for a fitted model
as_sem

Convert dsem to sem output
dsemRTMB

Fit dynamic structural equation model
parse_path

Parse path
logLik.dsem

Marginal log-likelihood
make_dsem_ram

Make a RAM (Reticular Action Model)
make_dfa

Make text for dynamic factor analysis
isle_royale

Isle Royale wolf and moose
predict.dsem

predictions using dsem
list_parameters

List fixed and random effects
plot.dsem

Simulate dsem
loo_residuals

Calculate leave-one-out residuals