influenceDiag {glmxdiag} | R Documentation |
Influence Diagnostic Measures
Description
Calculates or extracts some influence diagnostic measures such as DFbetas, Cook's distance and leverage.
Usage
influenceDiag(model, approx = TRUE)
Arguments
model |
a model supported by |
approx |
logical, if TRUE the function is faster but returns approximated results. |
Details
Leverage is extracted from the models using hatvalues
function of each model class.
The elements for GLMs and negative binomial regression models are always approximated as they are extracted from influence
function.
The argument approx
can be useful only with models of class vglm and betareg since influence
method function is not defined and items are fully calculated. It estimates n models where observations are excluded one by one. When approx = T
one step approximation is used; the tol parameter within every fitting model function is set high such that the fitting process stops at the first iteration hence results are not exact but they are supposed to be close.
For betabinomial models, cook's distance is replaced with the quantity (b - b(-i)) Var(b) (b - b(-i)))/p as suggested by glmtoolbox package..
The aim of the function is to group these diagnostic measures in one list; one should use influenceDiag
to calculate the measures and use the output object inside functions DFbeta
, cookDist
and leverage
in order to graphically visualize results.
Value
Returns a list of class "influence" with the following elements:
DFbeta |
data frame containing dfbetas for all observations and variables. |
cookDist |
a vector containing cook's distances. |
leverage |
hat values, i.e. the diagonal of the hat matrix. |
full.beta |
coefficients of the full model. |
family |
family name |
Author(s)
Giuseppe Reale
Examples
data("mtcars")
mod <- glm(mpg ~ cyl + hp + carb + wt, family = Gamma, data = mtcars)
inf <- influenceDiag(mod)
cookDist(inf)
leverage(inf)
DFbeta(inf)