QQplot: Quantile-Quantile Plot

View source: R/plots.R

QQplotR Documentation

Quantile-Quantile Plot

Description

QQplot is a generic function that produces QQ plot of two datasets, distribution and dataset or two distributions.

Usage

QQplot(
  d1,
  d2,
  line = TRUE,
  col = "#122e94",
  line_col = "#f28df9",
  xlab = deparse(substitute(d1)),
  ylab,
  main = "Q-Q plot",
  lwd = 2,
  ...
)

## Default S3 method:
QQplot(
  d1,
  d2,
  line = TRUE,
  col = "#122e94",
  line_col = "#f28df9",
  xlab = deparse(substitute(d1)),
  ylab = deparse(substitute(d2)),
  main = "Q-Q plot",
  lwd = 2,
  ...
)

## S3 method for class 'dist'
QQplot(
  d1,
  d2,
  line = TRUE,
  col = "#122e94",
  line_col = "#f28df9",
  xlab = deparse(substitute(d1)),
  ylab = ylabe,
  main = "Q-Q plot",
  lwd = 2,
  CI = re,
  conf = 0.95,
  n = 100,
  CI_col = "grey80",
  ...
)

QQnorm(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: '#122e94'.

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'.

lwd

lwd of qqline, default: 2.

...

further arguments to be passed.

CI

if confidence bound should be included.

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.

CI_col

color of confidence bound, default: 'grey80'.

Details

QQplot is able to compare any combination of dataset and distributions.

QQnorm is a wrapper around QQplot, 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.

Examples

# sample vs sample
QQplot(r(normdist(), 10000), r(tdist(df = 4), 10000))

# distribution vs sample
QQplot(normdist(), r(tdist(df = 4), 10000))

# distribution vs distribution
QQplot(normdist(), tdist(df = 4))

mistr documentation built on March 7, 2023, 7:42 p.m.