statplots(deprecated)/boxplot - Help

stats[statplots, boxplot]

Box Plot

 Calling Sequence stats[statplots, boxplot](data, $\mathrm{arg}=\mathrm{value}$, ...) statplots[boxplot(data, $\mathrm{arg}=\mathrm{value}$, ...) boxplot(data, $\mathrm{arg}=\mathrm{value}$, ...)

Parameters

 data - shift=x - (optional, default=0) plot center shifted to x width=w - (optional, default=1) width of the box plot format=notched - optionally format as a notched-box plot plotargs - additional plot options

Description

 • Important: The stats package has been deprecated. Use the superseding package Statistics instead.
 • The function boxplot of the subpackage stats[statplots, ...] gives a box plot summarizing the data in data.
 • A box plot comprises these elements:
 1) A box with

 - a central line showing the median, - a lower line showing the first quartile, - an upper line showing the third quartile;

 2) Two lines extending from the central box of maximal length 3/2 the interquartile range but not extending past the range of the data;
 3) Outliers, points that lie outside the extent of the previous elements.
 • Using the parameter format=notched will create a box plot with one additional feature.  The sides of the box are indented, or notched, at the median line.  This notch has a  maximal width of 3.14 times the interquartile range divided by the square root of the total weight of the data. The notch is constrained inside the first and third quartiles.
 • When there is more than one statistical list in data, a box plot will be produced for each data set.  Each box will be plotted on the same axes, side by side.
 • Box plots are quite useful to compare similar data sets. For example, one can quickly compare the monthly mid-day temperature over the period of one year by producing one boxplot per month, and displaying them side by side.
 • Notched-box plots can be used to determine if two random samples were drawn from the same population.  If the notches of each plot overlap, it is acceptable to say that both data sets have the same distribution. However, overlapping notches do not guarantee that the data sets are identically distributed.
 • Another use of box-plots is as a one-dimensional summary that is inserted in the edge of a scatter plot.
 • Classes are assumed to be represented by the class mark, for example $10..12$ has the value $11$. Missing data are ignored.
 • The command with(stats[statplots]) allows the use of the abbreviated form of this command.

Examples

Important: The stats package has been deprecated. Use the superseding package Statistics instead.

 > $\mathrm{with}\left(\mathrm{stats}\right):$
 > $\mathrm{data1}≔\left[2.93,2.58,2.85,4.26,2.94,4.33,1.71,4.42,3.59,4.35,2.07,1.16,2.36,1.16,4.72\right]:$
 > $\mathrm{data2}≔\left[2.46,4.34,0.182,3.22,5.37,10.5,3.11,-1.99,-0.865,2.56,10.6,10.9,6.56,7.22,4.84\right]:$
 > $p≔\mathrm{statplots}[\mathrm{boxplot}]\left(\mathrm{data1},\mathrm{axes}=\mathrm{FRAMED}\right):$$p$

change axes to frame:

 > $\mathrm{plots}[\mathrm{display}]\left(p,\mathrm{axes}=\mathrm{FRAME}\right)$

Usually, there are more than one box plot in a statistical plot. Two sets of data can be compared in this manner:

 > $\mathrm{with}\left({\mathrm{stats}}_{\mathrm{statplots}}\right):$
 > $\mathrm{boxplot}\left(\mathrm{data1},\mathrm{data2},\mathrm{shift}=1\right)$

Plotting data1 versus data2 with box plots in the margin of a scatter plot:

 > $\mathrm{P1}≔\mathrm{scatterplot}\left(\mathrm{data2},\mathrm{data1}\right):$

One of the box plots above x=14

 > $\mathrm{P2}≔\mathrm{boxplot}\left(\mathrm{data1},\mathrm{width}=\frac{1}{2},\mathrm{shift}=14\right):$

The other box plots above x=6

 > $\mathrm{P3}≔\mathrm{boxplot}\left(\mathrm{data2},\mathrm{width}=\frac{1}{2},\mathrm{shift}=6\right):$

Flip that one so that it is now on its side, centered at y=6

 > $\mathrm{P3b}≔\mathrm{xyexchange}\left(\mathrm{P3}\right):$

Display the composite plot.

 > $\mathrm{plots}[\mathrm{display}]\left(\left\{\mathrm{P1},\mathrm{P2},\mathrm{P3b}\right\},\mathrm{view}=\left[-3..15,0..6.5\right],\mathrm{axes}=\mathrm{FRAME}\right)$

Examples of notched box plots (use the abbreviated command):

 > $\mathrm{with}\left({\mathrm{stats}}_{\mathrm{statplots}}\right):$
 > $\mathrm{boxplot}\left(\mathrm{data1},\mathrm{format}=\mathrm{notched},\mathrm{axes}=\mathrm{FRAME}\right)$

In the following plot, one could conclude that data3 and data4 are samples from the same population, and that data5 was drawn from a different population. This is exactly the situation, since data3 and data4 come from a random sample of a chi-square distribution with three degrees of freedom, whereas data5 comes from a Student's t distribution with three degrees of freedom.

 > $\mathrm{data3}≔\left[2.44,1.90,3.54,0.270,4.05,1.43,7.90,8.48,4.56,0.907,3.22,1.22,1.55,6.55,1.72,0.507,0.792,2.62,3.02,0.718\right]:$
 > $\mathrm{data4}≔\left[6.20,1.55,7.02,4.06,2.58,0.917,1.87,0.731,0.883,0.548,5.14,1.28,1.07,0.398,0.665,0.230,4.88,5.02,6.65,1.92\right]:$
 > $\mathrm{data5}≔\left[0.0637,-1.15,-0.410,0.993,0.624,0.848,-0.257,-0.385,-0.180,0.282,-0.176,-0.410,1.09,1.94,0.618,0.520,2.61,-1.07,-0.719,0.717\right]:$
 > $\mathrm{boxplot}\left(\mathrm{data3},\mathrm{data4},\mathrm{data5},\mathrm{format}=\mathrm{notched},\mathrm{width}=\frac{1}{2},\mathrm{axes}=\mathrm{FRAMED}\right)$