model_fit_stats: Model Fit Statistics

View source: R/stat_funcs.R

model_fit_statsR Documentation

Model Fit Statistics

Description

Returns lm and glm model fit statistics R-squared, adjusted R-squared, predicted R-squared, PRESS, AIC, and BIC. Thanks to John Mount for his 6-June-2014 blog post, R style tip: prefer functions that return data frames" for the idea http://www.win-vector.com/blog/2014/06/r-style-tip-prefer-functions-that-return-data-frames

Usage

model_fit_stats(...)

Arguments

...

One or more lm or glm models, passed as bare (unquoted) names.

Value

A data frame containing containing the R-squared, adjusted R-squared, Predictive R-squared, PRESS, AIC, and BIC statistics for each model, with a row for each supplied model.

Examples

## Not run: 
m1_lm <- lm(mpg ~ disp + hp + drat + wt + qsec, data = mtcars)
m2_lm <- lm(mpg ~ disp + wt, data = mtcars)
m3_lm <- lm(mpg ~ hp + drat + qsec, data = mtcars)
m1_glm <- glm(mpg ~ disp + wt + qsec, data = mtcars)

model_fit_stats(m1_lm, m2_lm, m3_lm, m1_glm)

## End(Not run)

tomhopper/numbr documentation built on Nov. 5, 2022, 11:35 p.m.