PlotHat: Plot leverage hat values

View source: R/GLM_functions.R

PlotHatR Documentation

Plot leverage hat values

Description

This function plots leverage hat values from a glm() model fit against the observation index, and highlights observations with values exceeding a recommended cutoff.

Usage

PlotHat(x, id.n = 10)

Arguments

x

A glm() model fit object.

id.n

An integer specifying how many observations to label.

Details

=============================================================================

Fox (1997, p. 281) suggested a cutoff value for identifying observations with high leverage hat values in a GLM model. Plotting the hat values against the observation number (row index) and highlighting the values that exceed the cutoff is a quick way to inspect a model fit.

Value

None. This produces a plot via ggplot().

References

Fox, J. (1997). Applied regression analysis, linear models, and related methods. Thousand Oaks, CA: Sage Publications.

See Also

hatco for leverage cutoff.

Examples

 m1 <- glm(formula = vs ~ wt + disp, family = binomial, data = mtcars)
 PlotHat(m1)


sjpierce/piercer documentation built on Dec. 30, 2024, 3:28 p.m.