Learn R Programming

JWileymisc (version 1.4.1)

modelCompare: Compare Two Models

Description

Generic function.

Usage

modelCompare(model1, model2, ...)

as.modelCompare(x)

is.modelCompare(x)

# S3 method for lm modelCompare(model1, model2, ...)

Value

Depends on the method dispatch.

Arguments

model1

A fitted model object.

model2

A fitted model object to compare to model1

...

Additional arguments passed to specific methods.

x

An object (e.g., list or a modelCompare object) to test or attempt coercing to a modelCompare object.

Examples

Run this code
m1 <- lm(mpg ~ qsec * hp, data = mtcars)

m2 <- lm(mpg ~ am, data = mtcars)

modelCompare(m1, m2)

## cleanup
rm(m1, m2)

if (FALSE) {
m3 <- lm(mpg ~ 1, data = mtcars)
m4 <- lm(mpg ~ 0, data = mtcars)
modelCompare(m3, m4)

## cleanup
rm(m3, m4)
}

Run the code above in your browser using DataLab