Tables and axes > Statistical functions and totals > Creating percentiles and medians > Percentiles from factors > Factors in reverse order
 
Factors in reverse order
The n30 calculation for percentiles requires factors to be assigned to elements in ascending order. If you define factors in descending order, that is, from highest to lowest, Quantum will calculate a percentile but it will be incorrect when compared with the data.
Here are two tables to illustrate this.
The row axis for the first table is:
l rating1
col 137;Base;Excellent (fac=1);%fac=1+1;Very Good (fac=2);
+Good (fac=3);Fair (fac=4);Poor (fac=5)
n12Mean;dec=2
n30Median;dec=2;fac=50
The row axis for the second table is:
l rating2
col 137;Base;Excellent (fac=5);%fac=5-1;Very Good (fac=4);
+Good (fac=3);Fair (fac=2);Poor (fac=1)
n12Mean;dec=2
n30Median;dec=2;fac=50
The tables produced by these axes are as follows:
rating 1
 
rating 2
 
Base
25
Base
25
Excellent (fac=1)
 4
Excellent (fac=5)
 4
Very Good (fac=2)
 5
Very Good (fac=4)
 5
Good (fac=3)
 3
Good (fac=3)
 3
Fair (fac=4)
 4
Fair (fac=2)
 4
Poor (fac=5)
 9
Poor (fac=1)
 9
Mean
 3.36
Mean
 2.64
Median
 3.13
Median
 2.88
There are 25 respondents in both tables, so the median respondent is the 12.5th respondent. The first table shows that the median was between Good and Fair. This is correct because the 12.5th respondent lies between Good and Fair.
The second table also shows that the median rating was between Good and Fair. However this is wrong, because when the cases are sequenced in ascending factor order, the 12.5th respondent lies between Poor and Fair.
To create a table that uses the reverse order factors and produces a correct median, define the axis in two sections. The first section defines the elements as they are to be printed and with the factors required to create the mean. The second section defines the factors for the median but because it is defined using n11 and n15 statements it does not create lines in the table. In this section, the elements are defined in the opposite order (Poor to Excellent) so that the factors for the median appear in ascending sequential order.
Here is the revised axis:
l rating3
col 137;Base;Excellent (fac=5);%fac=5-1;Very Good (fac=4);
+Good (fac=3);Fair (fac=2);Poor (fac=1)
n12Mean;dec=2
n11
n15Poor;fac=1
n15Fair;fac=2
n15Good;fac=3
n15Very Good;fac=4
n15Excellent;fac=5
n30Median;dec=2;fac=50
The table that this axis produces is:
Base
25
Excellent (fac=5)
 4
Very Good (fac=4)
 5
Good (fac=3)
 3
Fair (fac=2)        
 4
Poor (fac=1)
 9
Mean
 2.64
Median
 1.88
See also
Percentiles from factors