1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
\name{stat_qq}
\alias{stat_qq}
\alias{StatQq}
\title{stat\_qq}
\description{Calculation for quantile-quantile plot}
\details{
This page describes stat\_qq, see \code{\link{layer}} and \code{\link{qplot}} for how to create a complete plot from individual components.
}
\section{Aesthetics}{
The following aesthetics can be used with stat\_qq. Aesthetics are mapped to variables in the data with the aes function: \code{stat\_qq(aes(x = var))}
\itemize{
\item \code{sample}: NULL (\strong{required})
\item \code{x}: x position
\item \code{y}: y position
}
}
\usage{stat_qq(mapping = NULL, data = NULL, geom = "point", position = "identity",
distribution = qnorm, dparams = list(), na.rm = FALSE, ...)}
\arguments{
\item{mapping}{mapping between variables and aesthetics generated by aes}
\item{data}{dataset used in this layer, if not specified uses plot dataset}
\item{geom}{geometric used by this layer}
\item{position}{position adjustment used by this layer}
\item{distribution}{NULL}
\item{dparams}{Parameters for distribution function}
\item{na.rm}{NULL}
\item{...}{Other arguments passed to distribution function}
}
\seealso{\itemize{
\item \url{http://had.co.nz/ggplot2/stat_qq.html}
}}
\value{A \code{\link{layer}}}
\examples{\dontrun{
# From ?qqplot
y <- rt(200, df = 5)
qplot(sample = y, stat="qq")
# qplot is smart enough to use stat_qq if you use sample
qplot(sample = y)
qplot(sample = precip)
qplot(sample = y, dist = qt, dparams = list(df = 5))
df <- data.frame(y)
ggplot(df, aes(sample = y)) + stat_qq()
ggplot(df, aes(sample = y)) + geom_point(stat = "qq")
# Use fitdistr from MASS to estimate distribution params
params <- as.list(MASS::fitdistr(y, "t")$estimate)
ggplot(df, aes(sample = y)) + stat_qq(dist = qt, dparam = params)
# Using to explore the distribution of a variable
qplot(sample = mpg, data = mtcars)
qplot(sample = mpg, data = mtcars, colour = factor(cyl))
}}
\author{Hadley Wickham, \url{http://had.co.nz/}}
\keyword{hplot}
|