validate | R Documentation |
Common regression fit statistics in a vector.
validate(model, dataframe = FALSE, ...)
model |
An lm, glm, or nls object. |
dataframe |
Logical. FALSE (default) outputs a matrix; TRUE outputs a dataframe. |
... |
Arguments passed to resid(). |
The broom library's glance() had a vague label for the F statistic (simply "statistic") and lacked the pseudo R-squared, which is commonly based on McFadden's version (i.e. 1 - (residual deviance / null deviance)). While the same function is friendly for data frames, it's wide form is cumbersome for quickly ascertaining model validity. Thus, validate() produces similar output as a column vector. Those who wish to have the values in broom's format can always transpose the vector.
Vector or dataframe. Includes F-statistic, R-squared, RMSE, and others.
adj.rsq = Adjusted R-Squared.
aer = Apparent Error Rate, calculated as the proportion of misclassifications (i.e. number of incorrect / total cases). Cutoff is the proportion of positive cases.
AIC = Akaike Information Criterion.
BIC = Bayesian Information Criterion.
convergence_tolerance = Tolerance of convergence, calculated from summary(model)$convInfo$finTol
df.den = degrees of freedom, denominator.
df.null = Degrees of freedom for the null deviance.
df.num = degrees of freedom, numerator.
df.sigma = degrees of freedom for sigma.
F.stat = F statistic
iterations = Number of iterations for NLS model to converge.
loglik = Log Likelihood.
mad = Median Absolute Deviation.
mae = Mean Absolute Error.
mpe = Mean Percentage Error.
medianpe = Median Percentage Error.
n = number of observations used in the model.
null.deviance = Null Deviance.
p.value = p-value for the F statistic.
pseudo.rsq.mcfad = McFadden's Pseudo R-Squared, calculated as 1 - (residual.deviance/null.deviance).
residual.deviance = Residual Deviance.
residual.mean = Mean of the residual.
residual.median = Median of the residual.
residual.sd = Standard deviation of the residual.
residual.se = Standard error of the residual.
rmse = Root Mean Square Error, calculated as sqrt(mean(resid(model)^2)).
rsq = R-squared.
sdpe = Standard Deviation of the Percent Error.
sepe = Standard Error of the Percent Error (sd(residuals
sigma = Standard deviation of the NLS model, calculated from summary(model)$sigma
https://github.com/robertschnitman/diagnoser
model.lm <- lm(data = mtcars, formula = mpg ~ wt + gear) validate(model.lm, TRUE) model.glm <- glm(data = mtcars, am ~ mpg + wt, family = binomial(link = 'logit')) validate(model.glm) model.nls <- nls(Ozone ~ theta0 + Temp^theta1, airquality) validate(model.nls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.