loading...

This function attempts to compute anova or deviance tables using the standard stats::anova() function. The original object is attached as an attribute to the result for reference.

anova_(object, ...)

Arguments

object

An object for which anova or deviance tables should be computed.

...

Additional arguments passed to the anova() function.

Value

An anova object with an additional "object" attribute containing the original input.

Examples

is_lm <- lm(data = iris, Petal.Length ~ Sepal.Length)
anova(is_lm)
#> Analysis of Variance Table
#> 
#> Response: Petal.Length
#>               Df Sum Sq Mean Sq F value    Pr(>F)    
#> Sepal.Length   1 352.87  352.87  468.55 < 2.2e-16 ***
#> Residuals    148 111.46    0.75                      
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

anova_(is_lm)
#> Analysis of Variance Table
#> 
#> Response: Petal.Length
#>               Df Sum Sq Mean Sq F value    Pr(>F)    
#> Sepal.Length   1 352.87  352.87  468.55 < 2.2e-16 ***
#> Residuals    148 111.46    0.75                      
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
attr(anova_(is_lm), "object")
#> 
#> Call:
#> lm(formula = Petal.Length ~ Sepal.Length, data = iris)
#> 
#> Coefficients:
#>  (Intercept)  Sepal.Length  
#>       -7.101         1.858  
#>