coef_compare {api2lm}R Documentation

Compare coefficients of 2 models

Description

Compare the coefficients to two fitted models. The models must have the same coefficients.

Usage

coef_compare(model1, model2, digits = 3, verbose = TRUE)

Arguments

model1

A fitted model object from the lm function.

model2

A fitted model object from the lm function.

digits

A positive integer indicating how many significant digits are to be used for numeric and complex numbers. This argument is passed to format.

verbose

A logical value indicating whether the matrix should be printed. The default is TRUE.

Value

A matrix.

Examples

# fit model
lmod1 <- lm(murder ~ hs_grad + urban + poverty + single,
           data = crime2009)
#fit without DC
lmod2 <- lm(murder ~ hs_grad + urban + poverty + single,
            data = crime2009[-9, ])
#compare coefficients of models
coef_compare(lmod1, lmod2)

[Package api2lm version 0.2 Index]