% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-ml.R
\name{geom_leverage}
\alias{geom_leverage}
\title{Leverage / Cook's distance plot}
\usage{
geom_leverage(
  mapping = NULL,
  data = NULL,
  color = NULL,
  size = NULL,
  alpha = NULL
)
}
\arguments{
\item{mapping, data}{Standard layer overrides. Map leverage to \code{x} and
the standardized residual to \code{y}; map \code{size} to Cook's distance.}

\item{color}{Point color.}

\item{size}{Point radius (used when \code{size} is not mapped).}

\item{alpha}{Point opacity.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
Standardized residual against leverage (hat value), the companion to
\code{\link[=geom_residual]{geom_residual()}} for spotting influential observations. Map \code{size} to
Cook's distance for the classic three-way read (leverage, residual
size, influence) in one scatter.
}
\examples{
m <- lm(dist ~ speed, cars)
d <- data.frame(
  hat = hatvalues(m), rstd = rstandard(m), cooksd = cooks.distance(m)
)
ggnext(d, aes(hat, rstd, size = cooksd)) +
  geom_leverage() +
  labs(title = "Leverage vs standardized residual",
       x = "Leverage (hat value)", y = "Standardized residual")
}
