Posts tonen met het label Statistics. Alle posts tonen
Posts tonen met het label Statistics. Alle posts tonen

vrijdag 30 mei 2014

2.1.2. About constructing tables in general


Common sense rules when it comes down to creating tables, but there are a few things each table should include:
  • A clear title for the table.
  • Clear column titles. Each column should be clear to what it shows. 'Income' for example is not very clear. It should mention somewhere either in the table title, column title or as a note that it is income in netto euro's per hour.
  • The source should also be listed. Where did the table come from.
Some formatting styles (such as APA and ASA) have fixed rules on where to place the above mentioned points, as well as which borders are and are not allowed to be drawn.

When creating classes you have to make sure that:
  1. The classes do not overlap (i.e. any value should only be able to fit in one of the classes, technically called mutual exclusive)
  2. Each value should be able to fit in one class (i.e. do not forget one or more classes, technically called inclusive or exhausting)
Since tables in descriptive statistics are used to summarize data and long tables are not so clear, it is often recommended not to create too many classes. There is no fixed rule for this, but between 5 and 20 is often seen as a rule of thumb. Based on tables often diagrams are drawn and those are often used as well to see how the data is distributed (a lot more on distribution will come later). Since the diagram will often depend on how the classes are created some far more technical methods are also available. These go beyond the scope of this blog, but from a few a summary can be found in Appendix B.

There is also some terminology that comes into play when talking about classes (or bins).

Symbols for class interval
There are a few different ways to represent the intervals. To indicate smaller than (but not equal to) the (in my opinion) most clear symbol would be <, and to indicate smaller than or equal to ≤. A more technical method is the use of [ or ] to indicate ‘including’ and ( or ) to indicate smaller than. The interval 2 < 5 is then the same as [2,5), and the interval 2 ≤ 5 is the same as [2,5].

Another symbol often used is a hyphen (-). It is however sometimes used as < is (Chaudhary, Kumar, & Alka, 2009; Sharma, 2007), and sometimes as ≤ is (Beri, 2010; Haighton, Haworth, & Wake, 2003a).

Class limit and Class boundary
If we have classes such as 0-2, 3-5, 6-10 the lower end is called the lower limit and the upper end the upper limit. Note however that a value of 2.498 would go into the first class of 0-2, so the true limits of the classes are actually 0 < 2.5, 2.5 < 5.5, 5.5 < 10.5. These are called the boundaries (the lower one the lower bound and the upper one the upper bound), also known as the true or closed limits. The class boundary is defined as "the value halfway between the upper limit of one class and the lower limit of the next class" (Kenney, 1939, p. 14). In many cases though people are not aware of the difference between boundaries and limits and interchange the words.

Class mark
The class mark is the average of the two limits (or boundaries) of that class. It is also known as midvalue or central value (Kenney, 1939).

This does however create a problem. To illustrate the problems an example. Let’s assume we have created classes on how many books people read a year as 0 < 2, 2 < 4 and so on. I could also write this as 0 ≤ 1, 2 ≤ 3 and so on.
To convert lower class limits into lower class boundaries we normally would simply subtract 0.5 and for the upper ones we add 0.5. For the class 2 ≤ 4 this would then become 1.5 and for the upper limit the boundary becomes 4.5. The class mark is then (1.5 + 4.5) / 2 = 3, however if I use the class limits the class mark would be (2 + 3) / 2 = 2.5. The 2.5 seems more appropriate in my opinion because we are talking about a discrete variable (nr. of books), so the class boundaries are only theoretical.

My recommendation is therefore to use < when the variable that is being grouped is continuous and ≤ when the variable is discrete, and define the class mark as: “The average of the two boundaries in case of a continuous variable that has been grouped and the average of the two limits in case of a discrete variable that has been grouped.”

Class interval and Class width
An interval is a range of values, so the class interval is the range of values that goes into that class. The interval can be stated either with the class limits or boundaries. The class width is how wide the class is and is also known as the class length (Bowerman et al., 2009).

Although frequencies are commonly used in tables, there is a variation of different types of frequencies.

>>Next section: Frequencies

References
Beri, G. C. (2010). Business Statistics (3rd ed.). New Delhi: Tata McGraw-Hill Education.
Bowerman, B. L., O’Connell, R. T., Murphree, E. S., Huchendorf, S. C., Porter, D. C., & Schur, P. J. (2009). Business statistics in practice. Boston, MA.: McGraw-Hill/Irwin.
Chaudhary, K. K. S., Kumar, A., & Alka. (2009). Statistics in Management Studies (10th ed.). Meerut: Krishna Prakashan Media.
Haighton, J., Haworth, A., & Wake, G. (2003). Statistics. Cheltenham: Nelson Thornes.
Kenney, J. F. (1939). Mathematics of Statistics; Part one. London: Chapman & Hall. Retrieved from http://archive.org/details/MathematicsOfStatisticsPartI
Sharma, J. K. (2007). Business Statistics (2nd ed.). Delhi: Pearson Education.

vrijdag 23 mei 2014

2.2.1. Circle diagram (a.k.a. Pie chart)


As the name implies a circle diagram is a circle divided into slices, each representing a category as in the example shown in Figure 3. 


Figure 3. Example of a pie chart

A circle has 360 degrees, equal to 100%. So by multiplying the relative frequencies with 360, the degrees for each category can be found. This means that visually the circle diagram can only show the relative frequencies.

The circle diagram is quite popular and often used, but actually has a few disadvantages:
  • It can only show relative frequencies. To show other frequencies the numbers themselves have to be added.
  • When the relative frequencies are close to each other, the differences are not easily seen in a circle diagram.
  • When there are many categories the circle diagram will look very busy and not easily to read. 
  • The circle diagram can only show one variable.
  • Do not use a pie chart for results of a multiple answer questions
An example of a 'bad' circle diagram was created by a program called ‘The Archivist’ and used in an article online (Perez, 2009) is shown in Figure 4.


Figure 4. Example of a pie chart with too many slices. Reprinted from 10 Ways to Archive Your Tweets, by S. Perez, 2009, Retrieved from http://readwrite.com/2009/08/10/10_ways_to_archive_your_tweets.

There are clearly too many categories and the few biggest slices are difficult to tell which is bigger. A possible solution in this case could have been to group the smallest categories into one category 'Other' and then still use a bar-chart instead.

Another example of a 'bad' circle diagram comes from The Economist (as cited in Kyd, 2012) shown in Figure 5.


Figure 5. Example of pie chart with rel. freq. too close to each other. Reprinted from Good Examples of Bad Charts: Chart Junk from a Surprising Source, by C. Kyd, 2012, Retrieved from http://exceluser.com/blog/1133/good-examples-of-bad-charts-chart-junk-from-a-surprising-source.html


It is very difficult to see the differences. It is not until you look at the numbers that you can tell which slices are bigger or smaller (with a few exceptions). A bar-chart would have been preferred.

A third example comes from fox-news, shown in Figure 6.


Figure 6. Example of a pie chart with percentages not adding up to 100.

This seems pretty odd that the percentages do not add up to 100%. This is probably because people could choose multiple options. The size of the slices is then most somewhat irrelevant. A bar-chart would have been preferred here.

There are many variations to the circle diagram. Some only add a visual effect (moving one or more slices out of the center a.k.a. exploded, or creating a 3D effect), and some more complex variations (such as the polar charts made famous by Florence Nightingale, doughnut charts, spie charts, etc.).

History
The earliest found circle diagram is found on the inlay of a book by William Playfair (1801) shown in Figure 7:


Figure 7. Earliest found pie chart. Reprinted from The statistical breviary: shewing the resources of every state and kingdom (p. inlay), by W. Playfair, 1801, London: T. Bensley

The name 'pie chart' might come from a misspelling of the word Pi. Pi is often associated with a circle. It might also simply come from the resemblances with a pie (as in apple-pie). However Srivastava & Rego (2011) put forward another belief that it is named after a royal French cook Pie, who served dishes in a pie-chart shape.

>>Next section: Bar-chart

References
Kyd, C. (2012, April 5). Good Examples of Bad Charts: Chart Junk from a Surprising Source. ExcelUser. Retrieved from http://exceluser.com/blog/1133/good-examples-of-bad-charts-chart-junk-from-a-surprising-source.html
Perez, S. (2009, August 10). 10 Ways to Archive Your Tweets. ReadWrite. Retrieved April 27, 2014, from http://readwrite.com/2009/08/10/10_ways_to_archive_your_tweets
Playfair, W. (1801). The statistical breviary: shewing the resources of every state and kingdom. London: T. Bensley. Retrieved from http://archive.org/details/statisticalbrev00playgoog. New edition on Amazon
Srivastava, T. N., & Rego, S. (2011). Business Research Methodology. New Delhi: Tata McGraw-Hill.

vrijdag 9 mei 2014

2.4.1. Quantiles, Fractiles: Quartiles, Hinges, Quintiles, Octiles, Deciles and Percentiles

Quantiles (also known as fractiles) is a general term described as quantities that are corresponding to different fractions of the frequency (Kenney & Keeping, 1954), some of these have been given special names.
  • Quartiles: Dividing the data into four sections
  • Quintiles: Dividing the data into five sections
  • Octiles: Dividing the data into eight sections
  • Deciles: Dividing the data into ten sections
  • Percentiles: Dividing the data into 100 sections
The most common one used is probably the Quartiles. These are the values at 25% intervals, each with their own name:
  • Q0 = 0% =zero quartile = minimum
  • Q1 = 25% = first quartile, lower quartile or lower median
  • Q2 = 50% = second quartile = median
  • Q3 = 75% = third quartile, upper quartile or upper median
  • Q4 = 100% = fourth quartile = maximum
Determining which value is the first and third quartile turns out to be trickier than perhaps first thought. In total I managed to find 14 different ways to compute the quartiles, each with a slightly different result depending on the dataset. I’ll discuss three methods to illustrate a few different approaches. For those really interested in the details from the other methods I recommend to read the article Quartiles in Elementary Statistics from Langford (2006).

If you have a multiple of 4 ordinal or scale items, most methods agree. The first quartile will be then between the n/4th item and the n/4+1-th item, the third quartile will be between the n/4x3-th item and the n/4x3+1-th item. If we had for example 8 items, the first quartile would be between the 2nd and 3rd item, and the third quartile between the 6th and 7th. This nicely divides the data into four groups as illustrated in Figure 23.

Figure 23. General idea of quartiles

What if we have 9, 10 or 11 items? One approach is to re-arrange the items in a W or M shape. These are then known as hinges (as Tukey (1977) called them), or inclusive quartiles. Figure 24 below illustrates this approach.

Figure 24. Illustration of Tukey hinges

In the figure above you can see that if there are 8 items, the 2.5th item will be the lower quartile, and the 6.5th item the upper quartile, if there are 9 items the 3rd and 7th item, in case of 10 items the 3rd and 8th and in case of 11 items the 3.5th and 8.5th.

If you look closely you might notice that hinges are at the median of the upper and lower half of the data. In the case where n is odd, this does mean that the median itself is counted twice. This explains why it is also sometimes called the inclusive method. Some authors disagree with this and suggest to exclude the median when determining the quartiles as illustrated in Figure 25.

 
Figure 25. Exclusive method illustration for quartiles

In the exclusive method, the median itself is removed from the data set and then the median from the lower part and upper part form the first and third quartile. If there are 8 items, the lower quartile will be the 2.5th item and the upper quartile the 6.5th. In case of 9 items it will be the 2.5th and 7.5th item, with 10 items the 2.5th and 8.5th and with 11 items the 3rd and 9th.

Another approach is focusses on the 25% idea from a quartile. If we have n items, then 25% of this will be at n x 0.25. If this is an integer (i.e. n is divisible by four) then the first quartile will be the average of n x 0.25-th item and the next one (n x 0.25 + 1-th). If it’s not an integer we simply round up. This approach is known as the cumulative or empirical distribution function and is the method eventually proposed by Langford (2006). The method is illustrated in Figure 26.

Figure 26. Illustration of the cumulative distribution function for quartiles

If there are 8 items then for the lower quartile we obtain 8 x 0.25 = 2, which is an integer so it will be between the 2nd and 3rd item. For the upper quartile we obtain 8 x 0.75 = 6, which is an integer so it will be between the 6th and 7th item. If there are 9 items we get 9 x 0.25 = 2.25, which gets rounded up to 3, so the lower quartile will be the 3rd item. For the upper quartile we get 9 x 0.75 = 6.75 =round up> 7. If there are 10 items the calculations go resp. 10 x 0.25 = 2.5 =round up> 3rd item, and 10 x 0.75 = 7.5 =round up> 8th item. If there are 11 items we get 11 x 0.25 = 2.75 =round up> 3rd item, and 11 x 0.75 = 8.25 =round up> 9th item.

The empirical distribution method can easily be adopted to determine the quintiles (simply use 0.2, 0.4, 0.6 and 0.8 instead of 0.25 and 0.75), deciles (use multiples of 0.1), octiles (use multiples of 0.125 and percentiles (use any value between 0 and 1).

Note that averaging out two values is only possible if numbers are used. If an ordinal data set is used this might not always be possible. One could then simply write something like “the lower quartile of the t-shirts sizes falls between small and medium”.

History
The first known use of the terms upper quartile and lower quartile comes from McAlister (1879). The term Hinges was introduced by Tukey (1977). The general term Quantiles is found was used by Kendall (1940). Galton (1885) uses the term percentile to describe the median as the 50th percentile and had used the term decile (1881) as well. Fisher, Thornton, & Mackenzie (1922) introduce the term quintiles.

>>Next section: Outliers, unusual scores and z-scores
 
References
Fisher, R. A., Thornton, H. G., & Mackenzie, W. A. (1922). The Accuracy of the Plating Method of Estimating the Density of Bacterial Populations. Annals of Applied Biology, 9, 325–359.
Galton, F. (1881). Report of the Anthropometric Committee. Report of the British Association for the Advancement of Science, 51, 225–272.
Galton, F. (1885). Some results of the Anthropometric Laboratory. Journal of the Anthropological Institute, 14, 275–287.
Kendall, M. G. (1940). Note on the Distribution of Quantiles for Large Samples. Supplement to the Journal of the Royal Statistical Society, 7(1), 83–85.
Kenney, J. F., & Keeping, E. S. (1954). Mathematics of Statistics; Part one (3rd ed.). New York: D. Van Nostrand Company.
Langford, E. (2006). Quartiles in Elementary Statistics. Journal of Statistics Education, 14(3). Retrieved from http://www.amstat.org/publications/jse/v14n3/langford.html
McAlister, D. (1879). The Law of the Geometric Mean. Proceedings of the Royal Society of London, 29(196-199), 367–376. doi:10.1098/rspl.1879.0061
Tukey, J. W. (1977). Exploratory Data Analysis. Pearson.