plot
::QQplot
Statistical quantilequantile plots
MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
plot::QQplot([a_{1}, a_{2}, …]
,[b_{1}, b_{2}, …]
, <a = a_{min} .. a_{max}
>,options
) plot::QQplot([[a_{1}, a_{2}, …], [b_{1}, b_{2}, …]]
, <a = a_{min} .. a_{max}
>,options
) plot::QQplot(A
, <a = a_{min} .. a_{max}
>,options
) plot::QQplot(s
, <c_{1}, c_{2}
>, <a = a_{min} .. a_{max}
>,options
) plot::QQplot(s
, <[c_{1}, c_{2}]
>, <a = a_{min} .. a_{max}
>,options
)
plot::QQplot(data1, data2)
plots the quantiles
of the first data set against the quantiles of the second data set.
plot::QQplot
creates a quantilequantile
plot of two discrete data samples [a_{1},
a_{2}, …]
and [b_{1},
b_{2}, …]
. A QQ plot displays
the collection of points with coordinates [x_{1},
y_{1}]
, [x_{2},
y_{2}]
etc., where x_i = stats::empiricialQuantile([a_1,
a_2, Symbol::dots])(i/(n  1))
and y_i = stats::empiricialQuantile([b_1,
b_2, Symbol::dots])(i/(n  1))
with i
running
from 0 through n 
1. The number of plot points n is
set by the attribute Size
= n.
If no value is specified by the user, n is
chosen as the minimum of the lengths of the data lists [a_{1}
, a_{2}
,
…] and [b_{1}
, b_{2}
,
…].
In addition, the diagonal reference line y = x is
displayed in the plot. This line can be suppressed by the attribute LinesVisible
= FALSE
.
The samples [a_{1}, a_{2}, …] and [b_{1}, b_{2}, …] do not need to have the same length.
A QQ plot is a graphical technique for determining if two data sets come from populations with a common distribution.
If the two sets come from a population with the same distribution, the points of the QQ plot should fall approximately along the reference line y = x. The greater the departure from this reference line, the greater the evidence for the conclusion that the two data sets have come from populations with different distributions.
A specialized version of the QQ plot is the “probability
plot”, where the quantiles of one of the data samples are replaced
with the quantiles of a theoretical distribution. You can use plot::QQplot
for
this type of plot, too, by using a reference list such as
[stats::normalQuantile(0, 1)(i/n) $ i = 1 .. n1]
as one of the data lists. In this particular case, data obeying a standard normal distribution should produce plot points close to the diagonal reference line y = x.
Cf. Example 3.
Attribute  Purpose  Default Value 

AffectViewingBox  influence of objects on the ViewingBox of
a scene  TRUE 
AntiAliased  antialiased lines and points?  TRUE 
Data  the (statistical) data to plot  
Frames  the number of frames in an animation  50 
Legend  makes a legend entry  
LegendText  short explanatory text for legend  
LegendEntry  add this object to the legend?  FALSE 
LineColor  color of lines  RGB::Red 
LineWidth  width of lines  0.35 
LineStyle  solid, dashed or dotted lines?  Solid 
LinesVisible  visibility of lines  TRUE 
Name  the name of a plot object (for browser and legend)  
ParameterEnd  end value of the animation parameter  
ParameterName  name of the animation parameter  
ParameterBegin  initial value of the animation parameter  
ParameterRange  range of the animation parameter  
PointSize  the size of points  1.5 
PointColor  the color of points  RGB::Black 
PointStyle  the presentation style of points  FilledCircles 
PointsVisible  visibility of mesh points  TRUE 
Size  size of a point list  
TimeEnd  end time of the animation  10.0 
TimeBegin  start time of the animation  0.0 
TimeRange  the real time span of an animation  0.0 .. 10.0 
Title  object title  
TitleFont  font of object titles  [" sansserif " , 11 ] 
TitlePosition  position of object titles  
TitleAlignment  horizontal alignment of titles w.r.t. their coordinates  Center 
TitlePositionX  position of object titles, x component  
TitlePositionY  position of object titles, y component  
Visible  visibility  TRUE 
VisibleAfter  object visible after this time value  
VisibleBefore  object visible until this time value  
VisibleFromTo  object visible during this time range  
VisibleAfterEnd  object visible after its animation time ended?  TRUE 
VisibleBeforeBegin  object visible before its animation time starts?  TRUE 
We create a QQ plot of some data samples:
a := [6, 9, 17, 0, 13, 9, 9, 12, 12, 12]: b := [7, 8, 20, 2, 11, 8, 9, 12, 13, 15, 2, 14]: q := plot::QQplot(a, b): plot(q)
We can modify the appearance of the QQ plot in various ways:
q::PointColor := RGB::Red: q::PointSize := 3*unit::mm: q::LineColor := RGB::Black: q::LineWidth := 1*unit::mm:
plot(q)
delete a, b, q:
We create some samples:
a := [stats::uniformRandom(1, 1)() $ k = 1..100]: b := [stats::normalRandom(0, 1)() $ k = 1..300]: c := [stats::normalRandom(0, 1)() $ k = 1..500]:
The left QQplot shows a clear deviation from the reference line y = x. The samples a and b do not seem to be chosen from the same population. The QQ plot of the samples b and c (both normally distributed with mean 0 and variance 1), however, shows data points close to the reference line:
plot(plot::Scene2d(plot::QQplot(a, b)), plot::Scene2d(plot::QQplot(b, c)), Width = 20*unit::cm, Rows = 1)
delete a, b, c:
We create a normally distributed sample:
data1 := [stats::normalRandom(0, 1)() $ k = 1..100]:
We wish to investigate whether these data can indeed be regarded as normally distributed. We create a reference sample of data that are definitely normally distributed:
n:= nops(data1): data2 := [stats::normalQuantile(0, 1)(i/n) $ i = 1 .. n1]:
The QQ plot of the data shows plot points close to the reference line y = x:
plot(plot::QQplot(data1, data2))
delete data1, n, data2:

The statistical data: numerical real values or arithmetical expressions of
the animation parameter


An array of domain type


A data collection of domain type


Column indices into 

Animation parameter, specified as 