fitres | R Documentation |
Create matrix of model fit, residuals, and residuals proportions.
fitres(model, data = NULL, fit_type = 'response', residual_type = 'response')
model |
An lm, glm, or nls(model = TRUE) object. |
data |
Dataframe. If defined, column-wise binds predictions/residuals to dataframe. |
fit_type |
String. Prediction type. See ?predict for details. |
residual_type |
String. See ?resid for details. |
fitres() creates a matrix of the fitted values, residuals, and residuals as a proportion (percent) of the actual dependent variable values based on an OLS model or GLM. If the data input is defined, then said matrix is column-wise binded to the specified dataset.
A matrix OR dataframe (if data is not null).
NLS objects will only work if "model = TRUE" is specified in the original NLS function.
https://github.com/robertschnitman/diagnoser
# OLS case model.lm <- lm(data = mtcars, formula = mpg ~ wt + gear) fitres(model.lm, fit_type = 'response') fitres(model.lm, data = mtcars) # NLS case model.nls <- nls(Ozone ~ theta0 + Temp^theta1, airquality, model = TRUE) fitres(model.nls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.