findn {weights} | R Documentation |
Summarize key model information including sample size and fit statistics
Description
findn
is a generic function that extracts useful summary information from a model object. It supports linear models (lm
), generalized linear models (glm
), ordinal regression models from polr
, mixed-effects models from lmer
, generalized additive models from gam
, and multinomial models from multinom
.
Usage
findn(x, ...)
Arguments
x |
A fitted model object of class |
... |
Additional arguments passed to methods (currently unused). |
Value
A named list with the following components, where available:
type
— A character string describing the model typen
— The number of observations used in the modelr.squared
— R-squared (for OLS and GAM models)adj.r.squared
— Adjusted R-squared (for OLS models)mcfadden
— McFadden's pseudo-R² (for GLMs andpolr
, ifpscl
is installed)aic
— AIC value for the model
The object is assigned class "findn"
with a custom print
method for display.
Author(s)
Josh Pasek
See Also
summary
, AIC
, pR2
, polr
, multinom
, lmer
, gam
Examples
data(mtcars)
mod1 <- lm(mpg ~ wt + hp, data = mtcars)
findn(mod1)
mod2 <- glm(am ~ wt + hp, data = mtcars, family = binomial)
findn(mod2)
library(MASS)
mod3 <- polr(Sat ~ Infl + Type + Cont, data = housing)
findn(mod3)
library(lme4)
mod4 <- lmer(Reaction ~ Days + (1 | Subject), data = sleepstudy)
findn(mod4)
library(mgcv)
mod5 <- gam(mpg ~ s(wt) + hp, data = mtcars)
findn(mod5)
library(nnet)
mod6 <- multinom(vs ~ wt + hp, data = mtcars, trace = FALSE)
findn(mod6)