Plotting Points for QQplots

DESCRIPTION:

Returns a vector of points equally spaced between 0 and 1 (or unequally-spaced if weights are provided); probabilities suitable to produce a QQplot.

USAGE:

ppoints(n, a=0.5, weights=NULL) 

REQUIRED ARGUMENTS:

n
number of points desired (if length(n)==1), or a vector whose length is the number of points desired. This is ignored if weights are present ( n is set to length(weights)).

OPTIONAL ARGUMENTS:

a
parameter that controls the precise placement of the plotting points, 0<=a<=1. The default is .5.
weights
numeric vector, the sum of whose elements must be positive. Missing values are not allowed. See VALUE below.

VALUE:

If no weights, a vector of length n containing the values (1:n - a)/(n+1-2*a). For a=.5 this is equivalent to returning the midpoints of the n equal subintervals of (0,1). Larger values of a move the points further away from each other (but still staying in the equal subintervals) and smaller values move them closer together.

If weights are present the interval (0,1) is divided into length(weights) subintervals such that the width of subinterval i is proportional to weights[i]. The parameter a controls the spacing of returned values from each subinterval as in the unweighted case.

DETAILS:

The result is a vector of probabilities suitable for use in probability (QQ) plots. Plotting sort(y) against qdist(p) (where p is this result) gives a probability (QQ) plot of y against the distribution for which qdist is the quantile function. The plot should be roughly linear if y is generated from the distribution with quantile function qdist.

REFERENCES:

Blom, G. (1958). Statistical Estimates and Transformed Beta Variables. Wiley, New York.

SEE ALSO:

, .

EXAMPLES:

y <- rlnorm(80)
plot(qlnorm(ppoints(y)), sort(y))   # log normal qqplot 
plot(qlnorm(ppoints(length(y))), sort(y))   # the same thing 
plot(qgamma(ppoints(rain.nyc2), 4), sort(rain.nyc2))