Quartile


A quartile is a type of quantile which divides the number of data points into four more or less equal parts, or quarters. The first quartile is defined as the middle number between the smallest number and the median of the data set. It is also known as the lower quartile or the 25th empirical quartile and it marks where 25% of the data is below or to the left of it. The second quartile is the median of a data set and 50% of the data lies below this point. The third quartile is the middle value between the median and the highest value of the data set. It is also known as the upper quartile or the 75th empirical quartile and 75% of the data lies below this point. Due to the fact that the data needs to be ordered from smallest to largest to compute quartiles, quartiles are a form of Order statistic.
Along with the minimum and the maximum of the data, which are also quartiles, the three quartiles described above provide a five-number summary of the data. This summary is important in statistics because it provides information about both the center and the spread of the data. Knowing the lower and upper quartile provides information on how big the spread is and if the dataset is skewed toward one side. Since quartiles divide the number of data points evenly, the range is not the same between quartiles. While the maximum and minimum also show the spread of the data, the upper and lower quartiles can provide more detailed information on the location of specific data points, the presence of outliers in the data, and the difference in spread between the middle 50% of the data and the outer data points.
For a visual representation see: https://www.mathsisfun.com/data/quartiles.html

Definitions

SymbolNamesDefinition
Q1splits off the lowest 25% of data from the highest 75%
Q2cuts data set in half
Q3splits off the highest 25% of data from the lowest 75%

Computing methods

Discrete Distributions

For discrete distributions, there is no universal agreement on selecting the quartile values.

Method 1

  1. Use the median to divide the ordered data set into two-halves.
  2. * If there is an odd number of data points in the original ordered data set, do not include the median in either half.
  3. * If there is an even number of data points in the original ordered data set, split this data set exactly in half.
  4. The lower quartile value is the median of the lower half of the data. The upper quartile value is the median of the upper half of the data.
This rule is employed by the TI-83 calculator boxplot and "1-Var Stats" functions.

Method 2

  1. Use the median to divide the ordered data set into two-halves.
  2. * If there are an odd number of data points in the original ordered data set, include the median in both halves.
  3. * If there are an even number of data points in the original ordered data set, split this data set exactly in half.
  4. The lower quartile value is the median of the lower half of the data. The upper quartile value is the median of the upper half of the data.
The values found by this method are also known as "Tukey's hinges"; see also midhinge.

Method 3

  1. If there are even numbers of data points, then Method 3 is the same as either method above.
  2. If there are data points, then the lower quartile is 25% of the nth data value plus 75% of the th data value; the upper quartile is 75% of the th data point plus 25% of the th data point.
  3. If there are data points, then the lower quartile is 75% of the th data value plus 25% of the th data value; the upper quartile is 25% of the th data point plus 75% of the th data point.

    Method 4

If we have an ordered dataset, we can interpolate between data points to find the th empirical quantile if is in the quantile. If we denote the integer part of a number by, then the empirical quantile function is given by,
where and.
To find the first, second, and third quartiles of the dataset we would evaluate,, and respectively.

Example 1

Ordered Data Set: 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49
Method 1Method 2Method 3Method 4
Q11525.520.2515
Q240404040
Q34342.542.7543

Example 2

Ordered Data Set: 7, 15, 36, 39, 40, 41
As there are an even number of data points, the first three methods all give the same results.
Method 1Method 2Method 3Method 4
Q115151513
Q237.537.537.537.5
Q340404040.25

Continuous Probability Distributions

If we define a continuous probability distributions as where is a real valued random variable, its cumulative distribution function is given by,
The CDF gives the probability that the random variable is less than the value. Therefore, the first quartile is the value of when, the second quartile is when, and the third quartile is when. The values of can be found with the quantile function where for the first quartile, for the second quartile, and for the third quartile. The quantile function is the inverse of the cumulative distribution function if the cumulative distribution function is monotonically increasing.

Outliers

There are methods by which to check for outliers in the discipline of statistics and statistical analysis. Outliers could be a result from a shift in the location or in the scale of the process of interest. Outliers could also may be evidence of a sample population that has a non-normal distribution or of a contaminated population data set. Consequently, as is the basic idea of descriptive statistics, when encountering an outlier, we have to explain this value by further analysis of the cause or origin of the outlier. In cases of extreme observations, which are not an infrequent occurrence, the typical values must be analyzed. In the case of quartiles, the Interquartile Range may be used to characterize the data when there may be extremities that skew the data; the interquartile range is a relatively robust statistic compared to the range and standard deviation. There is also a mathematical method to check for outliers and determining "fences", upper and lower limits from which to check for outliers.
After determining the first and third quartiles and the interquartile range as outlined above, then fences are calculated using the following formula:
where Q1 and Q3 are the first and third quartiles, respectively. The lower fence is the "lower limit" and the upper fence is the "upper limit" of data, and any data lying outside these defined bounds can be considered an outlier. Anything below the Lower fence or above the Upper fence can be considered such a case. The fences provide a guideline by which to define an outlier, which may be defined in other ways. The fences define a "range" outside which an outlier exists; a way to picture this is a boundary of a fence, outside which are "outsiders" as opposed to outliers. It is common for the lower and upper fences along with the outliers to be represented by a boxplot. For a boxplot, only the vertical heights correspond to the visualized data set while horizontal width of the box is irrelevant. Outliers located outside the fences in a boxplot can be marked as any choice of symbol, such as an "x" or "o". The fences are sometimes also referred to as "whiskers" while the entire plot visual is called a "box-and-whisker" plot.
When spotting an outlier in the data set by calculating the interquartile ranges and boxplot features, it might be simple to mistakenly view it as evidence that the population is non-normal or that the sample is contaminated. However, this method should not take place of a hypothesis test for determining normality of the population. The significance of the outliers vary depending on the sample size. If the sample is small, then it is more probable to get interquartile ranges that are unrepresentatively small, leading to narrower fences. Therefore, it would be more likely to find data that are marked as outliers.

Computer Software for Quartiles

Excel:
The Excel function QUARTILE provides the desired quartile value for a given array of data. In the Quartile function, array is the dataset of numbers that is being analyzed and quart is any of the following 5 values depending on which quartile is being calculated.
QuartOutput QUARTILE Value
0Minimum value
1Lower Quartile
2Median
3Upper Quartile
4Maximum value

MATLAB:
In order to calculate quartiles in Matlab, the function quantile can be used. Where A is the vector of data being analyzed and p is the percentage that relates to the quartiles as stated below.
pOutput QUARTILE Value
0Minimum value
0.25Lower Quartile
0.5Median
0.75Upper Quartile
1Maximum value