Learn R Programming

gap (version 1.0-20)

qqunif: Q-Q plot for uniformly distributed random variable

Description

This function produces Q-Q plot for a random variable following uniform distribution with or without using log-scale.

Usage

qqunif(u,logscale=TRUE,base=10,col=palette()[4],lcol=palette()[2],...)

Arguments

u
a vector of uniformly distributed random variables
logscale
to use logscale
base
the base of the log function
col
color for points
lcol
color for the diagonal line
...
other options as appropriae for the qqplot function

Value

  • The returned value is a list with components of a qqplot:
  • x-log(expected value for uniform order statistics)
  • y-log(observed value)

References

Davison AC. Statistical Models. Cambridge University Press 2003.

See Also

mhtplot

Examples

Run this code
# Q-Q Plot for 1000 U(0,1) r.v., marking those <= 1e-5
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")

Run the code above in your browser using DataLab