modelCompare: Compare Two Models

View source: R/models.R

modelCompareR Documentation

Compare Two Models

Description

Generic function.

Usage

modelCompare(model1, model2, ...)

as.modelCompare(x)

is.modelCompare(x)

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

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.

Value

Depends on the method dispatch.

Examples

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

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

modelCompare(m1, m2)

## cleanup
rm(m1, m2)

## Not run: 
m3 <- lm(mpg ~ 1, data = mtcars)
m4 <- lm(mpg ~ 0, data = mtcars)
modelCompare(m3, m4)

## cleanup
rm(m3, m4)

## End(Not run)

JWiley/JWileymisc documentation built on Feb. 15, 2024, 12:23 p.m.