loading...

anova.lm_() is a method for objects of class lm_, extending the standard stats::anova() functionality. It returns an ANOVA table similar to the base version but includes additional metadata such as variable labels (if available), making the output more informative for interpretation and reporting.

This method is part of the experimental lm_() modeling framework.

# S3 method for class 'lm_'
anova(object, ...)

Arguments

object

An object of class lm_, typically returned by lm_().

...

Additional arguments passed to stats::anova().

Value

An object of class anova_, which inherits from anova and may include a labels component if available in the original model.

Examples

data(iris)

# Add labels to variables
attr(iris$Sepal.Length, "label") <- "Sepal Length (cm)"
attr(iris$Petal.Length, "label") <- "Petal Length (cm)"

# Fit model using lm_()
model <- lm_(iris, Petal.Length ~ Sepal.Length + Species)

# Get ANOVA table with labels
anova_model <- anova(model)
anova_model
#> Analysis of Variance Table
#> 
#> Response: Petal.Length
#>               Df Sum Sq Mean Sq F value    Pr(>F)    
#> Sepal.Length   1 352.87  352.87 4419.48 < 2.2e-16 ***
#> Species        2  99.80   49.90  624.99 < 2.2e-16 ***
#> Residuals    146  11.66    0.08                      
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

# Access labels
anova_model$labels
#> NULL