Learn R Programming

piecewiseSEM (version 2.1.0)

anova.psem: 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 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

Value

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

Details

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

See Also

Anova

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab