drm_psem() is the piecewiseSEM-style core: you fit each endogenous node
yourself with drmTMB::drmTMB() and pass the fitted models. drmSEM extracts
the component-labelled graph, validates it as a DAG, and provides path
tables, d-separation tests, and simulation-based effects on top.
Usage
drm_psem(
...,
data = NULL,
covariances = NULL,
composites = NULL,
feedback = NULL
)
# S3 method for class 'drm_sem'
summary(object, ...)Arguments
- ...
Named fitted
drmTMBobjects, one per endogenous node. The name is the node identifier used in path queries; predictors are matched to a node by its name or its response variable.- data
The data frame all nodes were fitted to. Defaults to the data of the first node.
- covariances
Optional
covary()declaration(s) (one object or a list) recording residual (rho12) or higher-level (corpair) covariance edges between responses. These are reported bycovariances()and respected bybasis_set()/dsep(), but never enterpaths()or the effect decomposition.- composites
Optional
drm_composite()declaration(s). Fordrm_psem()the construct column(s) must already be present in the data the nodes were fitted on; the declarations are recorded soloadings()can report them.- feedback
Optional
drm_cycle()declaration(s) naming a feedback (cyclic) motif. Cycles are an error unless declared; a declared motif relaxes the topological-order requirement and is reported bycycles(). Node-wise fitting of a declared cycle is inconsistent under simultaneity (a warning is emitted); seedocs/design/10-cyclic-feedback.md.- object
A
drm_semobject.
Details
Fit nodes with control = drmTMB::drm_control(se = TRUE) so that vcov(),
Wald intervals, and d-separation refits are available.
References
Shipley B (2009). “Confirmatory Path Analysis in a Generalized Multilevel Context.” Ecology, 90(2), 363–368. doi:10.1890/08-1034.1 .
Lefcheck JS (2016). “piecewiseSEM: Piecewise Structural Equation Modelling in R for Ecology, Evolution, and Systematics.” Methods in Ecology and Evolution, 7(5), 573–579. doi:10.1111/2041-210X.12512 .
Brooks ME, Kristensen K, van Benthem KJ, Magnusson A, Berg CW, Nielsen A, Skaug HJ, Maechler M, Bolker BM (2017). “glmmTMB Balances Speed and Flexibility Among Packages for Zero-Inflated Generalized Linear Mixed Models.” The R Journal, 9(2), 378–400. doi:10.32614/RJ-2017-066 .
Rigby RA, Stasinopoulos DM (2005). “Generalized Additive Models for Location, Scale and Shape.” Journal of the Royal Statistical Society Series C: Applied Statistics, 54(3), 507–554. doi:10.1111/j.1467-9876.2005.00510.x .
See also
drm_sem() for the declarative interface that fits nodes for you.
Examples
if (FALSE) { # \dontrun{
ctrl <- drmTMB::drm_control(se = TRUE)
size_fit <- drmTMB::drmTMB(
drmTMB::bf(size ~ temp + habitat, sigma ~ temp),
family = stats::gaussian(), data = dat, control = ctrl)
abundance_fit <- drmTMB::drmTMB(
drmTMB::bf(abundance ~ size + temp, zi ~ habitat),
family = drmTMB::nbinom2(), data = dat, control = ctrl)
sem <- drm_psem(size = size_fit, abundance = abundance_fit, data = dat)
paths(sem)
} # }