leverage {glmxdiag} | R Documentation |
Visualize Leverages
Description
Graphical visualization of leverages for each observation within input model. Corresponds to the main diagonal of the hat matrix, i.e H[i,i].
Usage
leverage(object, label.id, n.label.id, xlab, ylab, pos,
hline, lcol, lwd, lty, ...)
Arguments
object |
object of class 'influence', see Details. |
label.id |
labels of observations, should be a vector with n elements. |
n.label.id |
number of observations with highest leverage to label in the plot. |
xlab |
title for the x axis. |
ylab |
title for the y axis. |
pos |
position of observations labels. Values |
hline |
numeric, where to position the horizontal line; useful to individuate points that exceed a specific treshold. Defaults to 2*p/n. |
lcol |
color of line. |
lwd |
width of line. |
lty |
type of line. |
... |
further arguments passed to |
Details
This function only works with objects given as output from influenceDiag
.
A rule of thumbs says that an observations has high leverage if H[i,i] > 2*p/n where p is the number of coefficients and n the sample size.
Value
Doesn't return a value, called for side effects.
Author(s)
Giuseppe Reale
Examples
data("mtcars")
mod <- glm(mpg ~ cyl + hp + carb, family = Gamma, data = mtcars)
inf <- influenceDiag(mod)
leverage(inf, label.id = rownames(mtcars))