fitresdf | R Documentation |
Merge fitted values and residuals to the original data frame.
fitresdf(model, data = NULL, fit_type = 'response', residual_type = 'response')
model |
An lm, glm, or nls object. |
data |
A data frame. If unspecified, then the original data is used (i.e. model.frame(model)). |
fit_type |
String. Default is "response". Type of fitted values to use based on options in predict(). |
residual_type |
String. Default is "response". Type of residuals values to use based on options in resid(). |
A data frame. "residual_margin" is the residuals as a proportion of the actual dependent variable values.
NLS objects will only work if "model = TRUE" is specified in the original NLS function.
https://github.com/robertschnitman/diagnoser
model.lm <- lm(data = mtcars, formula = mpg ~ wt + gear) fitresdf(data = mtcars, model = model.lm) # A warning message displays when there are missing values in the dataset. df <- mtcars df[1,1] <- NA model.lm <- lm(data = mtcars, formula = mpg ~ wt + gear) fitresdf(model.lm, data = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.