<summaryStatistics>
<summaryStatistics> is a General Operator
component that renders a table of statistics — mean, standard deviation, median,
quartiles and the rest — for the numbers it is given, whether written out or referenced
with $scores. Every statistic in the table is also a property, so a sentence can quote
the same number the table shows.
Attributes and Properties
Attributes for <summaryStatistics>
Highlighted (1)
[ keyword ]. Which summary statistics to display (or "default" / "all" / "fiveNumberSummary").
| Value | Description |
|---|---|
default (default) | The default selection: mean, stdev, count, minimum, quartile1, median, quartile3, maximum. |
all | Every statistic listed here. |
fiveNumberSummary | The five-number summary: minimum, quartile1, median, quartile3, maximum. |
mean | The arithmetic mean of the values. |
stdev | The sample standard deviation. |
variance | The sample variance. |
stderr | The standard error of the mean. |
count | The number of non-missing values. |
minimum | The smallest value. |
quartile1 | The first quartile (25th percentile). |
median | The median value. |
quartile3 | The third quartile (75th percentile). |
maximum | The largest value. |
range | The maximum minus the minimum. |
sum | The sum of the values. |
Number display (5)
avoidScientificNotationboolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.
displayDecimalsinteger. Default value: 2. Number of decimal places to display when rendering this number.
integer. Default value: 3. Number of significant digits to display when rendering this number.
displaySmallAsZeronumber. Default value: 1e-14. Threshold below which numbers are displayed as zero.
padZerosboolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <summaryStatistics name="s">
Highlighted (13)
$s.countinteger. The number of non-missing values.
$s.maximumnumber. The largest value.
$s.meannumber. The arithmetic mean of the values.
$s.mediannumber. The median value.
$s.minimumnumber. The smallest value.
$s.quartile1number. The first quartile (25th percentile).
$s.quartile3number. The third quartile (75th percentile).
$s.rangenumber. The maximum minus the minimum.
$s.statisticsToDisplaytextList. Which summary statistics to display.
$s.stderrnumber. The standard error of the mean.
$s.stdevnumber. The sample standard deviation.
$s.sumnumber. The sum of the values.
$s.variancenumber. The sample variance.
Number display (5)
$s.avoidScientificNotationboolean. Whether to render numbers in full decimal form rather than scientific notation.
$s.displayDecimalsinteger. Number of decimal places to display when rendering this number.
$s.displayDigitsinteger. Number of significant digits to display when rendering this number.
$s.displaySmallAsZeronumber. Threshold below which numbers are displayed as zero.
$s.padZerosboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Other (4)
$s.disabledboolean. Whether this component is disabled and cannot be interacted with.
$s.fixedboolean. Whether this component's value is fixed and cannot be modified.
$s.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
Common to all components (4)
$s.doenetMLtext. The DoenetML source code that produced this component.
$s.hideboolean. Whether to hide this component from the rendered output.
$s.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$s.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: statistics of a list
The table and the sentence read from the same component, so they cannot disagree.
Example: values that are not numbers
A value that is not a number counts as missing and is left out, which is why count
reports how many values were usable rather than how many were given. If nothing usable
is left, count is 0 and every other statistic has no value: its cell is blank, and a
reference to it reads as NaN.
Example: summarizing a simulation
The statistics are of the four counts, not of the 80 draws — so sum is the sample size
and mean is how many draws an average subpopulation received. Drawing again updates
both the counts and the table.
Attribute Examples
Attribute Example: statisticsToDisplay
Omit it for a standard selection. default, all and fiveNumberSummary name a set
rather than excluding what sits beside them, so statisticsToDisplay="default sum" shows
the standard selection and the sum. Statistics appear in a fixed order whatever order
they are asked for in, so two documents showing the same set read the same way.
Attribute Example: displayDigits
displayDigits shapes how the numbers are written, in the table and in a reference to a
statistic alike — a reference carries the same setting, so $rounded.mean prints 81.4
here rather than the mean in full. displayDecimals, displaySmallAsZero, padZeros
and avoidScientificNotation shape them the same way and follow the same rule.
count is the exception. It is an exact tally, so it is never rounded: this table would
still report 1234 observations as 1234, where three significant digits would have made
them 1230.
Property Examples
Property Example: mean, count, minimum, maximum, range
Every statistic is readable this way, stdev, variance, stderr, the quartiles,
median and sum included — and so are the ones the table was not asked to show:
statisticsToDisplay chooses what is displayed, not what is computed, so $s.minimum
and $s.maximum above are available from a table that lists neither.