Advanced tables and statistics > Descriptive statistics > Using Quantum statistics > Axis-level statistics
 
Axis-level statistics
Quick reference
To use an axis-level statistic, type:
stat=statistic_name[,element_text] [;options]
More information
Axis-level statistics are requested by means of a stat= statement as an element in the axis:
stat=statistic_name [,element_text] [;options]
where statistic_name is the name of the statistic to be computed, element_text is an optional element text to be printed in the table against the row or column of statistical values (if no text is given, none is printed), and options determine how the statistics are printed.
The names of statistics which can appear in axes are:
chi1
one-dimensional chi-squared test
friedman
Friedman’s test
z1
one-sample Z-test for proportions
t1
one-sample or paired t-test
Options are one or more of dec=, decp=, fac= and id=. Axis-level statistics are printed by default with two decimal places, but this can be altered by using the dec= option. Similarly, the significance levels are printed with three decimal places, and this can be altered using the decp= option.
The fac= option is only relevant to the z1 statistic.
The decp= option, which normally defines the number of decimal places for percentages, is used on a stat= element to define the number of decimal places for the significance level.
For more information on the use of dec=, decp=, fac= and id=, see Options on n, col, val, fld and bit statements.
For example:
stat=chi1,1-D chi-sq; dec=3; decp=4
calculates a one-dimensional chi-squared statistic and prints it with three decimal places and an element text of ‘1-D chi-sq’. Significance levels are printed with four decimal places.
Axis-level statistics only use data present in elements which appear before the stat= element in the axis. If the statistic is to use all the data in the axis it must come at the end of the axis. Additionally, if the axis contains a base element, the statistic is calculated using elements between the base and the statistics elements only. To include all elements, the base should therefore be the first element in the axis. For example:
l brands
ttlQ5: Brands Bought
col 132;Base;Brand A;Brand B
n03
stat=chi1,1-D chi-sq
col 132;Brand C='3';Brand D='4'
In this example the statistics are calculated for brands A and B only, whereas in the following example:
l brand2
ttlQ5: Brands Bought
col 132;Brand A;Brand B
col 133;Base;Brand C='3';Brand D='4'
n03
stat=chi1,1-D chi-sq
the statistics are calculated for brands C and D only.
If appropriate, more than one stat= element can be placed in an axis, as long as each one is preceded by a base element, if necessary, and the requisite number of rows. To request statistics for one set of elements in an axis, and further statistics for another non-overlapping set of elements, you must divide the axis into segments, each one beginning with a base element and ending with a stat= element. To request two or more tests on the same group of rows, enter the stat= statements, one to a line, after those rows.
Thus:
l allbrd
ttlQ5: Brands Bought
col 132;Base;Brand A;Brand B
n03
stat=chi1,1-D chi-sq A and B
n11Base
col 132;Brand C='3';Brand D='4'
n03
stat=chi1,1-D chi-sq C and D
produces two chi-squared statistics, the first for Brands A and B and the second for Brands C and D.
Statistics and the associated significance levels are printed as a row or column (depending on whether the axis is used as a row or column axis in the table), for every table in which the axis appears, at the point at which the stat= element is defined in the axis. The row or column text is as specified on the stat= statement, although if the axis is to be used as a column axis, the column headings can be defined on g statements. The statistic in each column (or row) is calculated from the figures in that column (or row), from the most recent base element, or the beginning of the table, through to the stat= element.
See also
Using Quantum statistics