Compute analysis of variance table for one or more structural equation models.
# S3 method for psem
anova(object, ..., digits = 3, anovafun = "Anova")
a psem
object
additional objects of the same type
number of digits to round results. Default is 3
The function used for ANOVA. Defaults to Anova
an F, LRT, or other table for a single model, or a list of comparisons between multiple models
Additional models will be tested against the first model using a Chi-squared difference test.
Anova
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)
#> Response Predictor Test.Stat DF P.Value
#> rich cover 2200.1 1 0.0015 **
#> cover firesev 1.7 1 0.0000 ***
#> firesev age 50.1 1 0.0000 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05
# conduct LRT
mod2 <- psem(
lm(rich ~ cover, data = keeley),
lm(cover ~ firesev, data = keeley),
age ~ 1,
data = keeley
)
anova(mod1, mod2)
#> Chi-square Difference Test
#>
#> Df AIC K n Chisq Chisq.diff Df.diff P.value
#> mod1 3 1103.492 9 90 11.313
#> vs mod2 3 773.453 6 90 11.313 0 0 1
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05