Today I took some time to write a little about Kurtosis. This is a particular tricky topic and didn't want to go into too many details.
The post can be found here: 2.6.2. Kurtosis
zaterdag 22 augustus 2015
zondag 3 mei 2015
Update 3rd May: updated measurement levels
Yesterday and today I dug into measurement levels again and adjusted the text on this on my blog. Stevens classification remains the most popular but now also wrote a few sentences on that it is not the only one.
updated entry: measurement levels
updated entry: measurement levels
maandag 6 april 2015
Update 6th April 2015 - Skewness
Finally had some time again and spend a few days on skewness. Came across 10 different methods to calculate this, and had a lot of 'fun' trying to find the original sources again.
Eventually this resulted in two more posts:
Skewness and Skewness formulas.
Since I anti-date the posts so their order appears logical, I also decided to keep updates like this one from now on.
Eventually this resulted in two more posts:
Skewness and Skewness formulas.
Since I anti-date the posts so their order appears logical, I also decided to keep updates like this one from now on.
zaterdag 31 januari 2015
Is this percentage different from ...? The Binomial Test - Basics
A binomial test can be used to test if a percentage from a sample is significantly different from another percentage.
For example:
An advertisement claims that 80% of the respondents said that they would keep on using the product. You would like to test this claim and ask 5 people yourself. Only 3 of your respondents mention they would keep on using the product.
The question is now if based on your data you can say the claim is likely to be correct or not?
The exact binomial test was first described by Bernoulli (1713). The number of calculations increase quickly when the sample size becomes bigger. Before the computer did the calculations these calculations could be avoided by using some form of an approximation. The null hypothesis tested is as shown in the figure below.
In the example this is therefor: Ho: π = 0.80.
Please note that I use the Greek letter pi for the population proportion, and p for the sample proportion, while some other textbooks use p for the population proportion and p-hat for the sample.
As for the alternative hypothesis (Ha) there are three variations:
Ho: π < 0.80.
Now we need to decide on how we are going to test this. It might surprise you that there are actually various tests that could be used, and there is no general agreed upon method to decide which test to use. More on this in the next section.
The basic binomial test will look at how many possible combinations there are to get the same or less successes, determine the probability for each and add them all up. It does this by using the following formula.
An explanation of where this formula comes from can be found in Appendix I . To find the probability of getting a result or more extreme as in our sample we can either:
Each of the above methods needs three values for the input: The sample size (usually denoted by n, in the example n = 5) or sometimes called number of trials, the probability for success on each trial (usually denoted by π, in the example π = 0.8), and the number of success found in the sample (usually denoted by k, in the example k = 3).
We are interested in the probability of obtaining the same or more extreme output. This is why we look at ‘cumulative’ probability tables, or in the output look for P(X ≤ …). In the example all methods should yield a p-value of 0.2627 (26%). This is the probability of obtaining 3 or less out of 5 in a sample, if the probability for success on each trial in the population is 0.80.
In reporting the results of a binomial test the proportion in the sample, the assumed proportion and the significance of the test should be reported, as well as an interpretation. Our final conclusion could read something like:
Advertiser X claimed that 80% of their respondents would like to continue using their product. A sample of five people was selected to test this claim. Only three people in the sample indicated they would like to continue using the product. A one-tailed binomial test was performed to test if the claim could be rejected. The test resulted in p = .263 indicating that there is insufficient evidence to reject the claim.
References
The question is now if based on your data you can say the claim is likely to be correct or not?
The exact binomial test was first described by Bernoulli (1713). The number of calculations increase quickly when the sample size becomes bigger. Before the computer did the calculations these calculations could be avoided by using some form of an approximation. The null hypothesis tested is as shown in the figure below.
In the example this is therefor: Ho: π = 0.80.
Please note that I use the Greek letter pi for the population proportion, and p for the sample proportion, while some other textbooks use p for the population proportion and p-hat for the sample.
As for the alternative hypothesis (Ha) there are three variations:
- One-sided left-tailed
In words: The probability of success in the population is less than …
In symbols: Ha: π < πH0 - One-sided right-tailed
In words: The probability of success in the population is more than …
In symbols: Ha: π > πH0 - Two sided
In words: The probability of success in the population is not …
In symbols: Ha: π ≠ πH0
Ho: π < 0.80.
Now we need to decide on how we are going to test this. It might surprise you that there are actually various tests that could be used, and there is no general agreed upon method to decide which test to use. More on this in the next section.
The basic binomial test will look at how many possible combinations there are to get the same or less successes, determine the probability for each and add them all up. It does this by using the following formula.
An explanation of where this formula comes from can be found in Appendix I . To find the probability of getting a result or more extreme as in our sample we can either:
- Perform the calculation by hand using the formula
- Use a table to find the corresponding probability
- Use a software package
- Use an online calculator (e.g. StatTrek, VasSarStats, or GraphPad)
Each of the above methods needs three values for the input: The sample size (usually denoted by n, in the example n = 5) or sometimes called number of trials, the probability for success on each trial (usually denoted by π, in the example π = 0.8), and the number of success found in the sample (usually denoted by k, in the example k = 3).
We are interested in the probability of obtaining the same or more extreme output. This is why we look at ‘cumulative’ probability tables, or in the output look for P(X ≤ …). In the example all methods should yield a p-value of 0.2627 (26%). This is the probability of obtaining 3 or less out of 5 in a sample, if the probability for success on each trial in the population is 0.80.
In reporting the results of a binomial test the proportion in the sample, the assumed proportion and the significance of the test should be reported, as well as an interpretation. Our final conclusion could read something like:
Advertiser X claimed that 80% of their respondents would like to continue using their product. A sample of five people was selected to test this claim. Only three people in the sample indicated they would like to continue using the product. A one-tailed binomial test was performed to test if the claim could be rejected. The test resulted in p = .263 indicating that there is insufficient evidence to reject the claim.
References
Bernoulli, J. (1713). Ars conjectandi. Impensis Thurnisiorum, fratrum.
vrijdag 30 januari 2015
Is this percentage different from ...? The Binomial Test - Variations
Why not always use an ‘exact’ test? Well, computational the exact test takes longer, and is sometimes criticized for being too ‘conservative’. This is because the exact (binomial) test is a discrete distribution (only integers), such as our number of successes, but the percentages themselves are continuous. Agresti & Coull (1998) wrote an article on confidence intervals and show that ‘approximate’ is better than ‘exact’, but McDonald (2014) argues that almost always an exact-test is preferred as long as the sample size is less than 1000.
The binomial exact test can be approximated by a: Chi-square-, normal- and Poisson distribution. If your probability of success in the population is very small, the Poisson distribution will be most appropriate. The difference between Chi-square and Normal approximation is very small (and in some cases even zero). The Normal approximation is often covered in textbooks (with or without a continuity correction), so more people are familiar with it.
If you opted for a Chi-square based approximation, you can choose either a Pearson Chi-square or a G-test (also known as likelihood ratio). According to Özdemir & Eyduran (2005) choosing between these two should be done based on the power test concept. A correction to each of these two can also be applied: Yates, Williams, or E. Pearson. The Yates correction has often shown to over-correct and is highly criticized (Thompson, 1988), Campbell (2007) recommends the E. Pearson’s.
If you have a two sided test, there is another choice to be made. A two sided test means you look for the same or more extreme in either direction. There are various methods that can be used to determine what is considered ‘more extreme’ in the other direction.
The easiest method is the Fisher-Irwin method, which simply doubles the one-sided significance value.
Another approach is the ‘equal distance’. In the example from the previous section we would have expected 0.8 x 5 = 4 successes. We only had 3, so a difference of 4 – 3 = 1. Taking an equal distance in the other direction would indicate 4 + 1 = 5 or more successes.
A third approach is, the Freeman-Halton approach (G. H. Freeman & Halton, 1951). They check the probability for each possible number of success above the one from the sample and only add the probabilities of those that are lower or equal to the one in the sample (known as the method of small p values).
Choosing among all of these options can be tricky. There are several opinions and an equal amount of rules of thumb. The choice could depend on a variety of things. The easiest would be if your instructor has his/her own personal preference, so he/she might have explicitly informed you that you should use a specific test. Another option that might make the choice easy is if you are using software that can only perform one or a few tests. The first choice to make is if you want to use a so-called ‘exact’ test, or use an approximation. If your sample size is small, none of the approximations will be accurate, so then an Exact test is your only option.
My personal suggestion at the moment would be the following: Level 1: If you want 95% confidence check if nπ(1-π)≥10, or if you use 99% confidence if nπ(1-π)≥35. If it is, use the normal approximation. This is based on Ramsey & Ramsey (1988) recommendation. If not, go to level 2
Level 2: If p < 0.05 (or > 0.95) and n > 20 use a Poisson approximation. If not use a Binomial exact test with the Freeman-Halton approach in case you want it two sided.
References
Agresti, A., & Coull, B. A. (1998). Approximate Is Better than “Exact” for Interval Estimation of Binomial Proportions. The American Statistician, 52(2), 119–126. http://doi.org/10.2307/2685469
Campbell, I. (2007). Chi-squared and Fisher-Irwin tests of two-by-two tables with small sample recommendations. Statistics in Medicine, 26(19), 3661–3675. http://doi.org/10.1002/sim.2832
McDonald, J. H. (2014, December). Small numbers in chi-square and G–tests. Retrieved December 25, 2014, from http://www.biostathandbook.com/small.html
Özdemir, T., & Eyduran, E. (2005). Comparison of Chi-Square and Likelihood Ratio Chi-Square Tests: Power of Test. Journal of Applied Sciences Research, 1(2), 242–244.
The binomial exact test can be approximated by a: Chi-square-, normal- and Poisson distribution. If your probability of success in the population is very small, the Poisson distribution will be most appropriate. The difference between Chi-square and Normal approximation is very small (and in some cases even zero). The Normal approximation is often covered in textbooks (with or without a continuity correction), so more people are familiar with it.
If you opted for a Chi-square based approximation, you can choose either a Pearson Chi-square or a G-test (also known as likelihood ratio). According to Özdemir & Eyduran (2005) choosing between these two should be done based on the power test concept. A correction to each of these two can also be applied: Yates, Williams, or E. Pearson. The Yates correction has often shown to over-correct and is highly criticized (Thompson, 1988), Campbell (2007) recommends the E. Pearson’s.
If you have a two sided test, there is another choice to be made. A two sided test means you look for the same or more extreme in either direction. There are various methods that can be used to determine what is considered ‘more extreme’ in the other direction.
The easiest method is the Fisher-Irwin method, which simply doubles the one-sided significance value.
Another approach is the ‘equal distance’. In the example from the previous section we would have expected 0.8 x 5 = 4 successes. We only had 3, so a difference of 4 – 3 = 1. Taking an equal distance in the other direction would indicate 4 + 1 = 5 or more successes.
A third approach is, the Freeman-Halton approach (G. H. Freeman & Halton, 1951). They check the probability for each possible number of success above the one from the sample and only add the probabilities of those that are lower or equal to the one in the sample (known as the method of small p values).
Choosing among all of these options can be tricky. There are several opinions and an equal amount of rules of thumb. The choice could depend on a variety of things. The easiest would be if your instructor has his/her own personal preference, so he/she might have explicitly informed you that you should use a specific test. Another option that might make the choice easy is if you are using software that can only perform one or a few tests. The first choice to make is if you want to use a so-called ‘exact’ test, or use an approximation. If your sample size is small, none of the approximations will be accurate, so then an Exact test is your only option.
My personal suggestion at the moment would be the following: Level 1: If you want 95% confidence check if nπ(1-π)≥10, or if you use 99% confidence if nπ(1-π)≥35. If it is, use the normal approximation. This is based on Ramsey & Ramsey (1988) recommendation. If not, go to level 2
Level 2: If p < 0.05 (or > 0.95) and n > 20 use a Poisson approximation. If not use a Binomial exact test with the Freeman-Halton approach in case you want it two sided.
References
Agresti, A., & Coull, B. A. (1998). Approximate Is Better than “Exact” for Interval Estimation of Binomial Proportions. The American Statistician, 52(2), 119–126. http://doi.org/10.2307/2685469
Campbell, I. (2007). Chi-squared and Fisher-Irwin tests of two-by-two tables with small sample recommendations. Statistics in Medicine, 26(19), 3661–3675. http://doi.org/10.1002/sim.2832
McDonald, J. H. (2014, December). Small numbers in chi-square and G–tests. Retrieved December 25, 2014, from http://www.biostathandbook.com/small.html
Özdemir, T., & Eyduran, E. (2005). Comparison of Chi-Square and Likelihood Ratio Chi-Square Tests: Power of Test. Journal of Applied Sciences Research, 1(2), 242–244.
zaterdag 31 mei 2014
2.1.1. Types of tables
The Oxford English dictionary defines a table as "a set of facts or figures systematically displayed, especially in columns".
Three main types of tables I distinguish (although variations on these exist) are:
- Frequency tables
- Grouped frequency tables
- Contingency tables
Example of a Frequency Table
Gender
|
Frequency
|
Female
|
28
|
Male
|
21
|
A grouped frequency table is similar as a frequency table but now the data has
been grouped into classes, to avoid long tables. Table
3
shows and example of a grouped frequency table.
Table 3
Example of a Grouped Frequency Table
A contingency table (or cross table) shows two variables; one in the rows and the other in the columns as for example shown in Table 4.
Table 4
Example of a Cross Table
Next entry: About constructing tables in general
Table 3
Example of a Grouped Frequency Table
Income
|
Frequency
|
0 < 10
|
8
|
10 < 20
|
12
|
20 < 50
|
22
|
50 or more
|
5
|
A contingency table (or cross table) shows two variables; one in the rows and the other in the columns as for example shown in Table 4.
Table 4
Example of a Cross Table
Gender
| ||
Income
|
Female
|
Male
|
0 < 10
|
4
|
6
|
10 < 20
|
8
|
12
|
20 < 50
|
10
|
13
|
50 or more
|
7
|
5
|
Next entry: About constructing tables in general
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.
When creating classes you have to make sure that:
- The classes do not overlap (i.e. any value should only be able to fit in one of the classes, technically called mutual exclusive)
- Each value should be able to fit in one class (i.e. do not forget one or more classes, technically called inclusive or exhausting)
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.
Labels:
class boundary,
class interval,
class limit,
class mark,
class width,
midvalue,
Statistics,
tables,
tally
Abonneren op:
Posts (Atom)