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

# 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

Author

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

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)
#>  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