Skip to contents

Q-Q plot for uniformly distributed random variables

Usage

qqunif(
  u,
  type = "unif",
  logscale = TRUE,
  base = 10,
  col = palette()[4],
  lcol = palette()[2],
  ci = FALSE,
  alpha = 0.05,
  ...
)

Arguments

u

A vector of uniformly distributed random variables.

type

Distribution type: "unif" for uniform order statistics or "exp" for exponential order statistics.

logscale

Logical; use log scale.

base

Base of the logarithm.

col

Color for points.

lcol

Color for the diagonal reference line.

ci

Logical; show confidence intervals.

alpha

Significance level for confidence intervals.

...

Additional graphical arguments passed to qqplot().

Value

Invisibly returns the list produced by qqplot() with components:

x

Expected quantiles.

y

Observed quantiles.

Details

This function produces a Q-Q plot for a random variable following a uniform distribution, optionally on a logarithmic scale.

For type = "exp", the plot is based on exponential order statistics, which is generally more appropriate than directly log-transforming the expected uniform order statistics.

References

Balakrishnan N, Nevzorov VB (2003). A Primer on Statistical Distributions. Wiley, Hoboken, N.J. ISBN 9780471427988. doi:10.1002/0471722227 . Casella G, Berger RL (2002). Statistical Inference, 2 edition. Duxbury. ISBN 978-0-534-24312-8. Davison AC (2003). Statistical Models (Cambridge Series in Statistical and Probabilistic Mathematics). Cambridge University Press (2003-08-04). doi:10.1017/CBO9780511815850 .

See also

Author

Jing Hua Zhao

Examples

if (FALSE) { # \dontrun{
u_obs <- runif(1000)
r <- qqunif(u_obs,pch=21,bg="blue",bty="n")
u_exp <- r$y
hits <- u_exp >= 2.30103
points(r$x[hits],u_exp[hits],pch=21,bg="green")
legend("topleft",sprintf("GC.lambda = %.4f",gc.lambda(u_obs)))
} # }