qqunif: Q-Q plot for uniformly distributed random variables

View source: R/qqunif.R

qqunifR Documentation

Q-Q plot for uniformly distributed random variables

Description

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().

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.

Value

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

x

Expected quantiles.

y

Observed quantiles.

Author(s)

Jing Hua Zhao

References

\insertRef

balakrishnan03gap \insertRefcasella02gap \insertRefdavison03gap

See Also

qqfun

Examples

## Not run: 
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)))

## End(Not run)


gap documentation built on May 28, 2026, 9:07 a.m.