QQplotgg {mistr} | R Documentation |
Implementation of Quantile-Quantile Plot with ggplot2
Description
QQplotgg is a generic function that produces QQ plot of two datasets, distribution and dataset or two distributions.
Usage
QQplotgg(
d1,
d2,
line = TRUE,
col = "#F9D607",
line_col = "#f28df9",
xlab = deparse(substitute(d1)),
ylab,
main = "Q-Q plot",
alpha,
lwd = 1,
...
)
## Default S3 method:
QQplotgg(
d1,
d2,
line = TRUE,
col = "#F9D607",
line_col = "#f28df9",
xlab = deparse(substitute(d1)),
ylab = deparse(substitute(d2)),
main = "Q-Q plot",
alpha = 0.5,
lwd = 1,
...
)
## S3 method for class 'dist'
QQplotgg(
d1,
d2,
line = TRUE,
col = "#F9D607",
line_col = "#f28df9",
xlab = deparse(substitute(d1)),
ylab = ylabe,
main = "Q-Q plot",
alpha = 0.7,
lwd = 1,
CI = re,
CI_alpha = 0.4,
CI_col = line_col,
conf = 0.95,
n = 100,
...
)
QQnormgg(d2, xlab = "Standard Normal", ylab = deparse(substitute(d2)), ...)
Arguments
d1 |
distribution object or dataset. |
d2 |
distribution object or dataset. |
line |
if qqline should be included, default: TRUE. |
col |
color of points, default: '#F9D607'. |
line_col |
color of qqline, default: '#f28df9'. |
xlab |
xlab, default: deparse(substitute(d1)). |
ylab |
ylab. default: deparse(substitute(d2)). |
main |
title, default: 'Q-Q plot'. |
alpha |
alpha of points, default: 0.7. |
lwd |
lwd of qqline, default: 1. |
... |
further arguments to be passed. |
CI |
if confidence bound should be included. |
CI_alpha |
alpha of confidence bound, default: 0.4. |
CI_col |
color of confidence bound , default: line_col. |
conf |
confidence level for confidence bound, default: 0.95. |
n |
number of points at which quantile functions are evaluated if two distributions are compared, default: 100. |
Details
QQplotgg
is able to compare any combination of dataset and distributions.
QQnormgg
is a wrapper around QQplotgg
, where d1 is set to normdist()
.
If quantiles of a continuous distribution are compared with a sample, a confidence bound for data is offered. This confidence "envelope" is based on the asymptotic results of the order statistics. For more details see https://en.wikipedia.org/wiki/Order_statistic.
Value
ggplot object.
Examples
# sample vs sample
QQplotgg(r(normdist(), 10000), r(tdist(df = 4), 10000))
# distribution vs sample
QQplotgg(normdist(), r(tdist(df = 4), 10000))
# distribution vs distribution
QQplotgg(normdist(), tdist(df = 4))