pp_plot():: The distribution function (vectorized).
qq_plot():: The quantile function (vectorized).
pch: plot symbol.
xlab: x-axis label.
ylab: y-axis label.
do.qqline: logical indicating whether a Q-Q line is plotted.
method: method used to construct the Q-Q line. If "theoretical", the theoretically true line with intercept 0 and slope 1 is displayed; if "empirical", the intercept and slope are determined with qqline(). The former helps deciding whether x comes from the distribution specified by FUN exactly, the latter whether x
comes from a location-scale transformed distribution specified by FUN.
qqline.args: list containing additional arguments passed to the underlying abline() functions. Defaults to list(a = 0, b = 1) if method = "theoretical" and list()
if method = "empirical".
...: additional arguments passed to the underlying plot().
Returns
invisible().
Details
Note that Q-Q plots are more widely used than P-P plots (as they highlight deviations in the tails more clearly).
Author(s)
Marius Hofert
Examples
## Generate datan <-1000mu <-1sig <-3nu <-3.5set.seed(271)# set seedx <- mu + sig * sqrt((nu-2)/nu)* rt(n, df = nu)# sample from t_nu(mu, sig^2)## P-P plotpF <-function(q) pt((q - mu)/(sig * sqrt((nu-2)/nu)), df = nu)pp_plot(x, FUN = pF)## Q-Q plotqF <-function(p) mu + sig * sqrt((nu-2)/nu)* qt(p, df = nu)qq_plot(x, FUN = qF)## A comparison with R's qqplot() and qqline()qqplot(qF(ppoints(length(x))), x)# the same (except labels)qqline(x, distribution = qF)# slightly different (since *estimated*)## Difference of the two methodsset.seed(271)z <- rnorm(1000)## Standardized dataqq_plot(z, FUN = qnorm)# fineqq_plot(z, FUN = qnorm, method ="empirical")# fine## Location-scale transformed datamu <-3sig <-2z. <- mu+sig*z
qq_plot(z., FUN = qnorm)# not fine (z. comes from N(mu, sig^2), not N(0,1))qq_plot(z., FUN = qnorm, method ="empirical")# fine (as intercept and slope are estimated)