Skip to contents

drm_node() records the model for a single endogenous (response) node without fitting it. It is the building block of the declarative interface drm_sem(): each node becomes one drmTMB::drmTMB() fit. The node's distributional-parameter formulae (for example mu, sigma, zi, hu, nu, sd(group), rho12) define component-labelled paths: a predictor in the sigma formula is a path to residual scale, not to the mean.

Usage

drm_node(formula, family = stats::gaussian(), ...)

Arguments

formula

A drmTMB::bf() / drmTMB::drm_formula() object, or a plain formula for a mean-only node. Plain formulas are wrapped with bf().

family

A drmTMB family (for example drmTMB::nbinom2(), drmTMB::beta_binomial(), or stats::gaussian()).

...

Further arguments passed to drmTMB::drmTMB() when the node is fitted (for example control).

Value

A drm_node specification object.

References

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 .

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 .

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 .

Examples

if (requireNamespace("drmTMB", quietly = TRUE)) {
  abundance <- drm_node(
    drmTMB::bf(count ~ size + temp + (1 | site), sigma ~ temp, zi ~ habitat),
    family = drmTMB::nbinom2()
  )
  abundance
}
#> <drm_node> family = "nbinom2"
#> <drm_formula>
#> count ~ size + temp + (1 | site)
#> sigma ~ temp
#> zi ~ habitat