qqunif {gap} | R Documentation |
Q-Q plot for uniformly distributed random variable
Description
Q-Q plot for uniformly distributed random variable
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 |
string option to specify distribution: "unif"=uniform, "exp"=exponential. |
logscale |
to use logscale. |
base |
the base of the log function. |
col |
color for points. |
lcol |
color for the diagonal line. |
ci |
logical option to show confidence interval. |
alpha |
1-confidence level, e.g., 0.05. |
... |
other options as appropriae for the qqplot function. |
Details
This function produces Q-Q plot for a random variable following uniform distribution with or without using log-scale. Note that the log-scale is by default for type "exp", which is a plot based on exponential order statistics. This appears to be more appropriate than the commonly used procedure whereby the expected value of uniform order statistics is directly log-transformed.
Value
The returned value is a list with components of a qqplot:
x expected value for uniform order statistics or its -log(,base) counterpart.
y observed value or its -log(,base) counterpart.
Author(s)
Jing Hua Zhao
References
Balakrishnan N, Nevzorov VB (2003). A Primer on Statistical Distributions. Wiley, Hoboken, N.J. ISBN 9780471427988, https://www.amazon.com/dp/B011SJAWXG/.
Casella G, Berger RL (2002). Statistical Inference, 2 edition. Duxbury. ISBN 978-0-534-24312-8, https://www.amazon.com/dp/7111109457/.
Davison AC (2003). Statistical Models (Cambridge Series in Statistical and Probabilistic Mathematics). Cambridge University Press (2003-08-04). https://www.amazon.com/dp/B01A0BLZKM/.
See Also
Examples
## Not run:
# 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")
legend("topleft",sprintf("GC.lambda=\
## End(Not run)