ANOVA: ANOVA

Description Usage Arguments Value Examples

View source: R/ANOVA.R

Description

ANOVA is used to obtain ANOVA table of a fitted model. It yields the same results as anova(lm( )) for sequential sums of squares and car::Anova(lm( ), type="III") for partial sums of squares.

Usage

1

Arguments

formula

An object of class "formula": a symbolic description of the model to be fitted. A typical model has the form outcome ~ covariates where outcome is the numeric response vector (which people usually denote as Y in statistical formula) and covariates are predictor of response.

data

A data frame (or object coercible by as.data.frame to a data frame) containing the variables in the model.

type

the type of sums of squares to be obtained. Use "Sequential" for sequential sums of squares and "Partial" for partial sums of squares.

Value

ANOVA returns ANOVA table in a data.frame.

Examples

1
2
3
ANOVA(mpg ~ cyl + wt, mtcars, type = "Partial") ## Get partial SS
ANOVA(mpg ~ cyl + wt + disp, mtcars, type = "Sequential") ## Get sequential SS
ANOVA(mpg ~ cyl + wt + disp, mtcars, type = "Sequential")["F value"] ## Extract F statistics from ANOVA table

AChenAC/LinearRegression documentation built on Dec. 17, 2021, 6:41 a.m.