stat_qq_line | R Documentation |
Draws a quantile-quantile line, with an additional detrend option.
stat_qq_line( mapping = NULL, data = NULL, geom = "path", position = "identity", na.rm = TRUE, show.legend = NA, inherit.aes = TRUE, distribution = "norm", dparams = list(), detrend = FALSE, identity = FALSE, qtype = 7, qprobs = c(0.25, 0.75), ... )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
The geometric object to use to display the data, either as a
|
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
distribution |
Character. Theoretical probability distribution function
to use. Do not provide the full distribution function name (e.g.,
|
dparams |
List of additional parameters passed on to the previously
chosen |
detrend |
Logical. Should the plot objects be detrended? If |
identity |
Logical. Should an identity line be used as the reference
line? If |
qtype |
Integer between 1 and 9. Only used if |
qprobs |
Numeric vector of length two. Only used if |
... |
Other arguments passed on to |
Thode, H. (2002), Testing for Normality. CRC Press, 1st Ed.
# generate random Normal data set.seed(0) smp <- data.frame(norm = rnorm(100)) # Normal Q-Q plot of Normal data gg <- ggplot(data = smp, mapping = aes(sample = norm)) + stat_qq_line() + stat_qq_point() + labs(x = "Theoretical Quantiles", y = "Sample Quantiles") gg # Exponential Q-Q plot of mean ozone levels (airquality dataset) di <- "exp" dp <- list(rate = 1) gg <- ggplot(data = airquality, mapping = aes(sample = Ozone)) + stat_qq_line(distribution = di, dparams = dp) + stat_qq_point(distribution = di, dparams = dp) + labs(x = "Theoretical Quantiles", y = "Sample Quantiles") gg # Detrended Exponential Q-Q plot of mean ozone levels di <- "exp" dp <- list(rate = 1) de <- TRUE gg <- ggplot(data = airquality, mapping = aes(sample = Ozone)) + stat_qq_line(distribution = di, detrend = de) + stat_qq_point(distribution = di, detrend = de) + labs(x = "Theoretical Quantiles", y = "Sample Quantiles") gg
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.