stats[statplots, boxplot]
Box Plot
Calling Sequence
Parameters
Description
Examples
stats[statplots, boxplot](data, arg=value, ...)
statplots[boxplot(data, arg=value, ...)
boxplot(data, arg=value, ...)
data
-
statistical list(s)
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
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.
with⁡stats:
data1≔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:
data2≔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:
p≔statplotsboxplot⁡data1,axes=FRAMED:p
change axes to frame:
plotsdisplay⁡p,axes=FRAME
Usually, there are more than one box plot in a statistical plot. Two sets of data can be compared in this manner:
with⁡statsstatplots:
boxplot⁡data1,data2,shift=1
Plotting data1 versus data2 with box plots in the margin of a scatter plot:
P1≔scatterplot⁡data2,data1:
One of the box plots above x=14
P2≔boxplot⁡data1,width=12,shift=14:
The other box plots above x=6
P3≔boxplot⁡data2,width=12,shift=6:
Flip that one so that it is now on its side, centered at y=6
P3b≔xyexchange⁡P3:
Display the composite plot.
plotsdisplay⁡P1,P2,P3b,view=−3..15,0..6.5,axes=FRAME
Examples of notched box plots (use the abbreviated command):
boxplot⁡data1,format=notched,axes=FRAME
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.
data3≔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:
data4≔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:
data5≔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:
boxplot⁡data3,data4,data5,format=notched,width=12,axes=FRAMED
See Also
describe(deprecated)[median]
describe(deprecated)[quartile]
Statistics
Statistics[BoxPlot]
statplots(deprecated)[xyexchange]
stats(deprecated)[data]
Download Help Document