extract_model_info {manymodelr} | R Documentation |
Extract important model attributes
Description
Provides a convenient way to extract any kind of model information from common model objects
Usage
extract_model_info(model_object = NULL, what = NULL, ...)
Arguments
model_object |
A model object for example a linear model object, generalized linear model object, analysis of variance object. |
what |
character. The attribute you would like to obtain for instance p_value |
... |
Arguments to other functions e.g. AIC, BIC, deviance etc |
Details
This provides a convenient way to extract model information for any kind of model. For linear models, one can extract such attributes as coefficients, p value("p_value"), standard error("std_err"), estimate, t value("t_value"), residuals, aic and other known attributes. For analysis of variance (aov), other attributes like sum squared(ssq), mean squared error(msq), degrees of freedom(df),p_value.
Examples
# perform analysis of variance
data("yields", package="manymodelr")
aov_mod <- fit_model(yields, "weight","height + normal","aov")
extract_model_info(aov_mod, "ssq")
extract_model_info(aov_mod, c("ssq","predictors"))
# linear regression
lm_model <-fit_model(yields, "weight","height","lm")
extract_model_info(lm_model,c("aic","bic"))
## glm
glm_model <- fit_model(yields, "weight","height","glm")
extract_model_info(glm_model,"aic")
[Package manymodelr version 0.3.7 Index]