# Quartile calculator Q1, Q3

### Quartile

In statistics, a quartile, a type of quantile, is three points that divide sorted data set into four equal groups (by count of numbers),
each representing a fourth of the distributed sampled population.

There are three quartiles: the first quartile (Q1), the second quartile (Q2), and the third quartile (Q3).

The first quartile (lower quartile, QL), is equal to the 25th percentile of the data. (splits off the lowest 25% of data from the highest 75%)

The second (middle) quartile or median of a data set is equal to the 50th percentile of the data (cuts data in half)

The third quartile, called upper quartile (QU), is equal to the 75th percentile of the data. (splits off the lowest 75% of data from highest 25%)

### How we calculating quartiles?

We sort set of data with n items (numbers) and pick n/4-th item as Q1, n/2-th item as Q2 and 3n/4-th item as Q3 quartile.
If indexes n/4, n/2 or 3n/4 aren't integers then we use interpolation between nearest items.

For example, for n=100 items, the first quartile Q1 is 25th item of ordered data, quartile Q2 is 50th item and quartile Q3 is 75th item. Zero quartile Q0 would be minimal item and the fourth quartile Q4 would be the maximum item of data, but these extreme quartiles are called minimum resp. maximum of set.

### How to enter data as a frequency table?

Simple. Write data elements (separated by spaces or commas, etc.), then write f: and further write the frequency of each data item. Each element must have a defined frequency that counts numbers before and after symbol f: must be equal. For example:1.1 2.5 3.99

f: 5 10 15

### How to enter grouped data?

Grouped data are formed by aggregating individual data into groups so that a frequency distribution of these groups serves as a convenient means of summarizing or analyzing the data.group | frequency |

10-20 | 5 |

20-30 | 10 |

30-40 | 15 |

10-20 20-30 30-40

f: 5 10 15

### How to enter data as a cumulative frequency table?

Similar to a frequency table, but instead, f: write cf: in the second line. For example:10 20 30 40 50 60 70 80

cf: 5 13 20 32 60 80 90 100

The cumulative frequency is calculated by adding each frequency from a frequency distribution table to the sum of its predecessors. The last value will always equal the total for all observations since the calculator will have already added all frequencies to the previous total.

### Questions

#### Question1:

There seems to be a problem with the 5-figure calculator. I placed the following data set and the Q3, giving a wrong value. 8, 12, 9, 8, 16, 10 ,14, 7, 5, 21, 13, 10, 8, 10, 11, 8, 11, 9, 11, 14. I used The program, against TI and Casio graphics calculator as well as a different program. This website gave me 12.75, while the calculators and the other website gave me 12.5.

#### Answer1:

All seems OK. But there are at least three methods to compute quartiles.

For large numbers of data, all methods converge to the same results. For small datasets, the methods differ in how they interpolate gaps in the input data.

#### Answer2:

Q3 in case 20 values, so its indexes is 0... 19

quartile3 index is 19*0.75 = 14.25

and quartile3 value Q3 = 0.75*12+0.25*13 = 12.25

#### Question2

Your Quartile calculator has an error. Both Q1 & Q3 are incorrect with the data set below. Your calculator says Q1 is 13 and Q3 is 44. Correct answers: Q1 is 13.5 and Q3 is 41. Verified with third party and Excel spreadsheet. There is definitely a problem with your code. When a data set has an even number of items all three methods will have the same result!! In my example, Q1 should be 13.5 no matter what!

{0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 28, 28, 28, 28, 28, 29, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 36, 37, 37, 38, 38, 38, 38, 38, 38, 38, 40, 41, 41, 41, 42, 43, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 52, 52, 52, 53, 54, 54, 54, 55, 55, 55, 56, 56, 56, 56, 57, 59, 61, 61, 63, 63, 69, 70, 70, 77, 80}

#### Answer2

Hi Peter, Thank you for adding the method buttons! So I see "Method 2" is the algorithm you had before. "Method 1" is more accurate and the preferred method. "Method 2" is acceptable but still has the same bug as before. It only happens when the data set is even. Again, Q1 & Q3 results should be the same for evens regardless of method per the Wikipedia article. I'll give you a really simple example which shows the error I've been talking about all along. Try data set { 3, 7, 7, 9 }. Each method gives different results but Method 1 is indeed correct. Q1 should be 5 and Q3 should be 8 for both methods. Hope this helps!

Consider the set:

{1,2,3,4,5,6,7,8,9,10,11,12,13}

Clearly, Q2 is 7, Q1 is 3.5, and Q3 is 10.5. However, your program yields

"Quartile Q1: 4

Quartile Q2: 7

Quartile Q3: 10"

^ This is incorrect.

I think the error in the algorithm is in how it creates the lower and upper halves after finding Q2.

Consider the set:

{1,2,3,4,5,6}

If the list is of even length, Q2 will be the average of the two middle values (e.g. Q2 = [3+4]/2 = 3.5) . Hence, the lower half should be a list ranging from the LOW (i.e. the lowest value in the original set of values) to the floor of Q2 (e.g. if Q2=3.5, the floor of Q2 is 3). Hence,

lower half = {1,2,3}

The upper half should range from the ceiling of Q2 (e.g. is Q2=3.5, the ceiling of Q2 is 4) to the HIGH (i.e. the highest value in the original set of values). Hence,

upper half = {4,5,6)

A visual:

1 2 3 4 5 6

1 * 3 * 4 * 6

Q2 = 3.5

Q1 = 2

Q3 = 5

## Practice problems from statistics:

- Increase the mean

To which number should the number 4 be changed between the numbers 4,5,7, 1,0,9,7,8, -3,5 to increase these numbers' arithmetic mean by 1.25? - 75th percentile (quartille Q3)

Find 75th percentile for 30,42,42,46,46,46,50,50,54 - The size 2

The size of pants sold during one business day in a department store is 32, 38, 34, 42, 36, 34, 40, 44, 32, and 34. Find the average size of the pants sold. - Harmonic HM example

Find the harmonic mean of 4 and 8. - The data

The data set represents the number of cars in a town given a speeding ticket each day for ten days. 2 4 5 5 7 7 8 8 8 12 What is the IQR? - 45 percentile

Given the following data 11 15 24 33 10 35 23 25 40 What is P45? - Median and modus

Radka made 50 throws with a dice. The table saw fit individual dice's wall frequency: Wall Number: 1 2 3 4 5 6 frequency: 8 7 5 11 6 13 Calculate the modus and median of the wall numbers that Radka fell. - The raw

The raw data presented here are the scores (out of 100 marks) of a market survey regarding the acceptability of a new product launched by a company for a random sample of 50 respondents: 40 45 41 45 45 30 30 8 48 25 26 9 23 24 26 29 8 40 41 42 39 35 18 25 - Average

If the average(arithmetic mean) of three numbers x,y, and z are 50. What is the average of their numbers (3x +10), (3y +10), (3z+10)? - Dataset:

Dataset: 35 22 18 54 22 46 28 31 43 22 14 17 25 19 33 14. 1 Group the data into a grouped distribution using six classes of equal width. 2. Determine the mean, median, and mode using the raw data. 3. Draw an Ogive curve corresponding to the data and use i - Dataset

Data: 11,15,11,16,12,17,13,21,14,21,15,22 Find dispersion of a given dataset.

more math problems »