Draw a quantile-quantile plot
qqplot(x,y) // compare two data sets x and y qqplot(x,dist,p1,p2,...) // compare x with a distribution function with parameters p1,p2,... qqplot(x) // compare x with the standard normal distribution function (N(0,1))
data set x (vector)
a second data set y (vector) to compare with x
distribution function (beta | bin | chi | chn | f | fnc | gam | nbn | nor | poi | t) (string).
parameters relevant for the selected distribution function. See Description for details.
Compare two data sets by plotting the quantiles of each set against each other (x versys y). One data set may also be plotted against quantiles generated from a statistical distribution function.
If the data sets come from identical distributions the points fall along the 45degree line (x=y). If the data sets come from distributions that are linearly dependent the points fall along a straight line different from x=y.
A straight line is drawn through the first and third quantile of the two data sets.
Calling sequence for comparing data set x with the available distribution functions:
// Compare two data sets x=rand(25,1); y=rand(20,1); scf(); qqplot(x,y); // they should come from the same distribution // The rand() function does not follow a normal N(0,1) distribution. scf(); qqplot(rand(100,1)); ylabel('Samples from rand()'); // Use grand() to get a normal distribution scf(); qqplot(grand(100,1,'nor',0,1)); ylabel('grand(100,1,''nor'',0,1)'); // Example from the R package (www.r.org). // Precipitation in US Cities, (Statistical Abstracts of the United States, 1975.). precip=[67.0, 54.7, 7.0, 48.5, 14.0, 17.2, 20.7, 13.0, 43.4, 40.2, 38.9, 54.5, 59.8, 48.3, 22.9,.. 11.5, 34.4, 35.1, 38.7, 30.8, 30.6, 43.1, 56.8, 40.8, 41.8, 42.5, 31.0, 31.7, 30.2, 25.9,.. 49.2, 37.0, 35.9, 15.0, 30.2, 7.2, 36.2, 45.5, 7.8, 33.4, 36.1, 40.2, 42.7, 42.5, 16.2,.. 39.0, 35.0, 37.0, 31.4, 37.6, 39.9, 36.2, 42.8, 46.4, 24.7, 49.1, 46.0, 35.9, 7.8, 48.2,.. 15.2, 32.5, 44.7, 42.6, 38.8, 17.4, 40.8, 29.1, 14.6, 59.2]; scf(); qqplot(precip) // compare with a N(0,1) distribution. ylabel('Precipitation in 70 US cities [in/yr]'); | ![]() | ![]() |
Wikipedia; http://en.wikipedia.org/wiki/Q-Q_plot