anova.psem: ANOVA and chi-squared difference test for model comparison

View source: R/anova_psem.R

anova.psemR Documentation

ANOVA and chi-squared difference test for model comparison

Description

Compute analysis of variance table for one or more structural equation models.

Usage

## S3 method for class 'psem'
anova(object, ..., digits = 3, anovafun = "Anova")

Arguments

object

a psem object

...

additional objects of the same type

digits

number of digits to round results. Default is 3

anovafun

The function used for ANOVA. Defaults to Anova

Details

Additional models will be tested against the first model using a Chi-squared difference test.

Value

an F, LRT, or other table for a single model, or a list of comparisons between multiple models

Author(s)

Jon Lefcheck <lefcheckj@si.edu>, Jarrett Byrnes <jarrett.byrnes@umb.edu>

See Also

Anova

Examples

data(keeley)

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

# get type II Anova
anova(mod1)

# conduct LRT
mod2 <- psem(
  lm(rich ~ cover, data = keeley),
  lm(cover ~ firesev, data = keeley),
  age ~ 1,
  data = keeley
)

anova(mod1, mod2)


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