Skip to contents

For each claim X || Y in basis_set(), dsep() refits node Y with X added as a fixed-effect predictor to every modelled distributional component, and compares it to the base node fit by a likelihood-ratio test. A small p-value means X carries information about some component of Y beyond Y's parents, i.e. a missing arrow.

Usage

dsep(object, ...)

# S3 method for class 'drm_sem'
dsep(object, ...)

Arguments

object

A drm_sem object.

...

Unused.

Value

A data frame of claims with df, LR, and p.value, carrying a fisher_c attribute (see fisher_c()). A status column records why a claim was not tested: "no_data_column" (the claim's variable is not a column), "refit_failed", "n_mismatch" (the augmented refit used a different number of observations than the base fit, usually because the added variable has missing values, so the likelihood ratio would compare two different samples), "degenerate" (non-nested or non-finite), or "wrong_scale" (the added variable is constant within a grouping the node does not already model, so the LRT would credit one row per observation while the variable carries only as many independent pieces of information as there are groups). Only "ok" claims enter Fisher's C.

Two further columns report the claim's scale. n_effective and scale_group are NA when the claim's variable varies row by row. When it is constant within a grouping the node does not already model – a species-level trait repeated down to individuals, say – they name that grouping and its number of levels, status is "wrong_scale", and dsep() warns.

That situation matters because the likelihood ratio treats every row as independent evidence: a chance group-level association is credited with far more support than it has, so the test rejects TRUE independences rather than missing false ones. Fisher's C therefore excludes these p-values rather than inheriting the false rejection (D-21). The flattened p-value stays in the table so the mismatch is inspectable. The remedy is to add the grouping term to that node so the base and augmented fits share it, then re-run. drmSEM does not auto-add (1 | group): that would test a different SEM than the one in paths(). Adding the term to only the augmented fit would compare two different random-effect structures, which is not a valid likelihood-ratio test.

Details

This is the local-likelihood d-separation test of Shipley (2000, 2009), extended in drmSEM from a mean-only test to an any-component test (the claim that X is irrelevant to every modelled distributional parameter of Y). This any-component extension is a drmSEM construction; it has been calibrated against the family-grid data-generating processes in inst/calibration/.

When the SEM declares latent = marginalised names, the claims come from the MAG branch of basis_set(); the LRT itself is unchanged (any-component).

Requires nodes fitted so that refits converge (the declarative drm_sem() requests standard errors automatically).

References

Shipley B (2000). “A New Inferential Test for Path Models Based on Directed Acyclic Graphs.” Structural Equation Modeling, 7(2), 206–218. doi:10.1207/S15328007SEM0702_4 .

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 .

Pearl J (2009). Causality: Models, Reasoning, and Inference, 2nd edition. Cambridge University Press, Cambridge.

Examples

if (FALSE) { # \dontrun{
sem <- drm_sem(
  size = drm_node(drmTMB::bf(size ~ temp + habitat, sigma ~ temp),
                  family = stats::gaussian()),
  abundance = drm_node(drmTMB::bf(abundance ~ size + temp, zi ~ habitat),
                       family = drmTMB::nbinom2()),
  data = dat)
dsep(sem)
} # }