powered by
Graphical visualization of leverages for each observation within input model. Corresponds to the main diagonal of the hat matrix, i.e H[i,i].
leverage(object, label.id, n.label.id, xlab, ylab, pos, hline, lcol, lwd, lty, ...)
object of class 'influence', see Details.
labels of observations, should be a vector with n elements.
number of observations with highest leverage to label in the plot.
title for the x axis.
title for the y axis.
position of observations labels. Values 1, 2, 3, 4 respectively indicate below, left, above, right.
1, 2, 3, 4
numeric, where to position the horizontal line; useful to individuate points that exceed a specific treshold. Defaults to 2*p/n.
color of line.
width of line.
type of line.
further arguments passed to plot
plot
Doesn't return a value, called for side effects.
This function only works with objects given as output from influenceDiag.
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.
# NOT RUN { data("mtcars") mod <- glm(mpg ~ cyl + hp + carb, family = Gamma, data = mtcars) inf <- influenceDiag(mod) leverage(inf, label.id = rownames(mtcars)) # }
Run the code above in your browser using DataLab