LLchisq: Generalized chi-squared for piecewise SEM

View source: R/LLchisq.R

LLchisqR Documentation

Generalized chi-squared for piecewise SEM

Description

Derivation of log-likelihoods to be used in determining the goodness-of-fit for piecewise structural equation models.

Usage

LLchisq(
  modelList,
  basis.set = NULL,
  direction = NULL,
  interactions = FALSE,
  conserve = FALSE
)

Arguments

modelList

A list of structural equations created using psem.

basis.set

An optional list of independence claims.

direction

A vector of claims defining the specific directionality of independence claims; for use in special cases (see dSep.

interactions

whether interactions should be included in basis set. Default is FALSE

conserve

Whether the most conservative log-likelihood should be returned; for use in special cases (see Details). Default is FALSE.

Details

Here, a list of saturated models is first derived from the list of structured equations using the basis set. Then, the differences in summed log-likelihoods are computed and used to calculate the Chi-squared statistic.

Value

a data.frame corresponding to the Chi-squared statistic, d.f., and P-value

Author(s)

Jon Lefcheck <LefcheckJ@si.edu>

References

Shipley, Bill, and Jacob C. Douma. "Generalized AIC and chi‐squared statistics for path models consistent with directed acyclic graphs." Ecology 101.3 (2020): e02960.

See Also

basisSet, dSep

Examples

mod <- psem(
lm(rich ~ cover, data = keeley),
lm(cover ~ firesev, data = keeley),
lm(firesev ~ age, data = keeley),
data = keeley
)

LLchisq(mod)


piecewiseSEM documentation built on June 22, 2024, 9:53 a.m.