Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Quartile
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Statistic which divides data into four same-sized parts for analysis}} {{Use mdy dates|date=May 2020}} In [[statistics]], '''quartiles''' are a type of [[quantile|quantiles]] which divide the number of data points into four parts, or ''quarters'', of more-or-less equal size. The data must be ordered from smallest to largest to compute quartiles; as such, quartiles are a form of [[order statistic]]. The three quartiles, resulting in four data divisions, are as follows: * The first quartile (''Q''<sub>1</sub>) is defined as the 25th [[percentile]] where lowest 25% data is below this point. It is also known as the ''lower'' quartile. * The second quartile (''Q''<sub>2</sub>) is the [[median]] of a data set; thus 50% of the data lies below this point. * The third quartile (''Q''<sub>3</sub>) is the 75th percentile where lowest 75% data is below this point. It is known as the ''upper'' quartile, as 75% of the data lies below this point.<ref name=":0">{{Cite book |author=Dekking, Michel <!--1946β --> |url=https://archive.org/details/modernintroducti0000unse_h6a1 |title=A modern introduction to probability and statistics: understanding why and how |date=2005 |publisher=Springer |isbn=978-1-85233-896-1 |location=London |pages=[https://archive.org/details/modernintroducti0000unse_h6a1/page/236/ 236-238] |oclc=262680588 |url-access=limited}}</ref> Along with the minimum and 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 [[Mean (Statistics)|center]] and the [[Statistical dispersion|spread]] of the data. Knowing the lower and upper quartile provides information on how big the spread is and if the dataset is [[Skewness|skewed]] toward one side. Since quartiles divide the number of data points evenly, the [[Range (statistics)|range]] is generally not the same between adjacent quartiles (i.e. usually (''Q''<sub>3</sub> - ''Q''<sub>2</sub>) β (''Q''<sub>2</sub> - ''Q''<sub>1</sub>)). [[Interquartile range]] (IQR) is defined as the difference between the 75th and 25th percentiles or ''Q''<sub>3</sub> - ''Q''<sub>1</sub>. 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 [[outlier]]s in the data, and the difference in spread between the middle 50% of the data and the outer data points.<ref>{{Cite web |url=https://magoosh.com/statistics/quartiles-used-statistics/ |archive-url=https://web.archive.org/web/20191210060305/https://magoosh.com/statistics/quartiles-used-statistics/ |archive-date=2019-12-10 |url-status=deviated |title=How are Quartiles Used in Statistics? |last=Knoch |first=Jessica |date=February 23, 2018 |website=[[Magoosh]] |access-date=February 24, 2023}}{{cbignore}}</ref> == Definitions == [[File:Boxplot vs PDF.svg|thumb|[[Boxplot]] (with quartiles and an [[interquartile range]]) and a [[probability density function]] (pdf) of a normal N(0,1Ο<sup>2</sup>) population]] {| class="wikitable" !Symbol !Names !Definition |- ! ''Q''<sub>1</sub> |{{plainlist|style=font-weight:bold| * First quartile * Lower quartile * 25th [[percentile]] }} | Splits off the lowest 25% of data from the highest 75% |- ! ''Q''<sub>2</sub> |{{plainlist|style=font-weight:bold| * Second quartile * [[Median]] * 50th percentile }} | Cuts data set in half |- ! ''Q''<sub>3</sub> |{{plainlist|style=font-weight:bold| * Third quartile * Upper quartile * 75th percentile }} | Splits 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.<ref>{{cite journal |title=Sample quantiles in statistical packages|journal=American Statistician |date=November 1996 |volume=50 |issue=4 |pages=361β365 |first1=Rob J |last1=Hyndman |author1-link=Rob J. Hyndman |first2=Yanan |last2=Fan |url=http://robjhyndman.com/papers/quantiles/ |doi=10.2307/2684934|jstor=2684934|url-access=subscription }}</ref> ==== Method 1 ==== # Use the [[median]] to divide the ordered data set into two halves. The median becomes the second quartile. #* If there are an odd number of data points in the original ordered data set, '''do not include''' the median (the central value in the ordered list) in either half. #* If there are an even number of data points in the original ordered data set, split this data set exactly in half. # 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 ==== # Use the median to divide the ordered data set into two halves. The median becomes the second quartile. #* If there are an odd number of data points in the original ordered data set, '''include''' the median (the central value in the ordered list) in both halves. #* If there are an even number of data points in the original ordered data set, split this data set exactly in half. # 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 "[[John Tukey|Tukey]]'s hinges";<ref>{{Cite book|isbn=978-0-201-07616-5|title=Exploratory Data Analysis|last1=Tukey|first1=John Wilder|author-link=John Tukey|date=1977|publisher=Addison-Wesley Publishing Company |url-access=registration|url=https://archive.org/details/exploratorydataa00tuke_0}}</ref> see also [[midhinge]]. ==== Method 3 ==== # Use the median to divide the ordered data set into two halves. The median becomes the second quartile. #* If there are odd numbers of data points, then go to the next step. #* If there are even numbers of data points, then the Method 3 starts off the same as the Method 1 or the Method 2 above and you can choose to include or not include the median as a new datapoint. If you choose to include the median as the new datapoint, then proceed to the step 2 or 3 below because you now have an odd number of datapoints. If you do not choose the median as the new data point, then continue the Method 1 or 2 where you have started. # If there are (4''n''+1) data points, then the lower quartile is 25% of the ''n''th data value plus 75% of the (''n''+1)th data value; the upper quartile is 75% of the (3''n''+1)th data point plus 25% of the (3''n''+2)th data point. # If there are (4''n''+3) data points, then the lower quartile is 75% of the (''n''+1)th data value plus 25% of the (''n''+2)th data value; the upper quartile is 25% of the (3''n''+2)th data point plus 75% of the (3''n''+3)th data point. ==== Method 4 ==== If we have an ordered dataset <math>x_1, x_2, ..., x_n</math>, then we can interpolate between data points to find the <math>p</math>th empirical [[quantile]] if <math>x_i</math> is in the <math>i/(n+1)</math> quantile. If we denote the integer part of a number <math>a</math> by <math>\lfloor a \rfloor</math>, then the empirical quantile function is given by, <math>q(p/4) = x_{k} + \alpha(x_{k+1} - x_{k})</math>, <math>x_{k}</math> is the last data point in quartile ''p'', and <math>x_{k+1}</math> is the first data point in quartile ''p''+1. <math>\alpha</math> measures where the quartile falls between <math>x_{k}</math> and <math>x_{k+1}</math>. If <math>\alpha</math> = 0 then the quartile falls exactly on <math>x_{k}</math>. If <math>\alpha</math> = 0.5 then the quartile falls exactly half way between <math>x_{k}</math> and <math>x_{k+1}</math>. <math>q(p/4) = x_{k} + \alpha(x_{k+1} - x_{k})</math>, where <math>k = \lfloor p(n+1)/4 \rfloor</math> and <math>\alpha = p(n+1)/4 - \lfloor p(n+1)/4 \rfloor</math>.<ref name=":0" /> To find the first, second, and third quartiles of the dataset we would evaluate <math>q(0.25)</math>, <math>q(0.5)</math>, and <math>q(0.75)</math> respectively. ==== Example 1 ==== Ordered Data Set (of an odd number of data points): 6, 7, 15, 36, 39, '''40''', 41, 42, 43, 47, 49. The bold number (40) is the median splitting the data set into two halves with equal number of data points. {| class="wikitable" |- ! ! Method 1 ! Method 2 ! Method 3 !Method 4 |- ! ''Q''<sub>1</sub> | 15 | 25.5 | 20.25 |15 |- ! ''Q''<sub>2</sub> | 40 | 40 | 40 |40 |- ! ''Q''<sub>3</sub> | 43 | 42.5 | 42.75 |43 |} ==== Example 2 ==== Ordered Data Set (of an even number of data points): 7, 15, '''36, 39''', 40, 41. The bold numbers (36, 39) are used to calculate the median as their average. As there are an even number of data points, the first three methods all give the same results. (The Method 3 is executed such that the median is not chosen as a new data point and the Method 1 started.) {| class="wikitable" |- ! ! Method 1 ! Method 2 ! Method 3 !Method 4 |- ! ''Q''<sub>1</sub> | 15 | 15 | 15 |13 |- ! ''Q''<sub>2</sub> | 37.5 | 37.5 | 37.5 |37.5 |- ! ''Q''<sub>3</sub> | 40 | 40 | 40 |40.25 |} === Continuous probability distributions === [[File:NormalCDFQuartile3.svg|thumb|Quartiles on a cumulative distribution function of a normal distribution]] If we define a [[continuous probability distribution]]s as <math>P(X)</math> where <math>X</math> is a [[Real number|real valued]] [[random variable]], its [[cumulative distribution function]] (CDF) is given by <math>F_X(x) = P(X \leq x)</math>.<ref name=":0" /> The [[Cumulative distribution function|CDF]] gives the probability that the random variable <math>X</math> is less than or equal to the value <math>x</math>. Therefore, the first quartile is the value of <math>x</math> when <math>F_X(x) = 0.25</math>, the second quartile is <math>x</math> when <math>F_X(x) = 0.5</math>, and the third quartile is <math>x</math> when <math>F_X(x) = 0.75</math>.<ref>{{Cite web|url=https://math.bme.hu/~nandori/Virtual_lab/stat/dist/CDF.pdf|title=6. Distribution and Quantile Functions|website=math.bme.hu}}</ref> The values of <math>x</math> can be found with the [[quantile function]] <math>Q(p)</math> where <math>p = 0.25</math> for the first quartile, <math>p = 0.5</math> for the second quartile, and <math>p = 0.75</math> for the third quartile. The quantile function is the inverse of the cumulative distribution function if the cumulative distribution function is [[Monotonic function|monotonically increasing]] because the [[Bijection|one-to-one correspondence]] between the input and output of the cumulative distribution function holds. == 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 (mean) or in the scale (variability) of the process of interest.<ref>{{Cite journal|last=Walfish|first=Steven|date=November 2006|title=A Review of Statistical Outlier Method|url=http://www.statisticaloutsourcingservices.com/|journal=Pharmaceutical Technology}}</ref> Outliers could also 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. The [[Interquartile Range]] (IQR), defined as the difference between the upper and lower quartiles (<math display="inline">Q_3 - Q_1 </math>), may be used to characterize the data when there may be extremities that skew the data; the [[interquartile range]] is a relatively [[robust statistic]] (also sometimes called "resistance") compared to the [[Range (statistics)|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 (lower) and third (upper) quartiles (<math display="inline">Q_1</math> and <math display="inline">Q_3</math> respectively) and the interquartile range (<math display="inline">\textrm{IQR} = Q_3 - Q_1 </math>) as outlined above, then fences are calculated using the following formula: : <math>\text{Lower fence} = Q_1 - (1.5 \times \mathrm{IQR}) </math> : <math>\text{Upper fence} = Q_3 + (1.5 \times \mathrm{IQR})</math>[[File:Boxplot outliers example.jpg|thumb|Boxplot Diagram with Outliers]] 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. 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. It is common for the lower and upper fences along with the outliers to be represented by a [[Box plot|boxplot]]. For the boxplot shown on the right, 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 easy 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 varies 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.<ref>{{Cite journal|last=Dawson|first=Robert|date=July 1, 2011|title=How Significant is a Boxplot Outlier?|journal=Journal of Statistics Education|volume=19|issue=2|doi=10.1080/10691898.2011.11889610|doi-access=free}}</ref> == Computer software for quartiles == {| class="wikitable" |+ !Environment !Function !Quartile Method |- |Microsoft Excel |QUARTILE.EXC |Method 4 |- |Microsoft Excel |QUARTILE.INC |Method 3 |- |TI-8X series calculators |1-Var Stats |Method 1 |- |R |fivenum |Method 2 |- |R | quantile (default) | Method 4 |- |Python |numpy.percentile |Method 4 (with nβ1) |- |Python |pandas.DataFrame.describe |Method 3 |} === Excel === The Excel function ''QUARTILE.INC(array, quart)'' provides the desired quartile value for a given array of data, using Method 3 from above. The ''QUARTILE'' function is a legacy function from Excel 2007 or earlier, giving the same output of the function ''QUARTILE.INC''. In the 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. <ref>{{Cite web|url=https://exceljet.net/excel-functions/excel-quartile-function|title=How to use the Excel QUARTILE function {{!}} Exceljet|website=exceljet.net|access-date=December 11, 2019}}</ref> {| class="wikitable" |+ !Quart !Output QUARTILE Value |- |0 |Minimum value |- |1 |Lower Quartile (25th percentile) |- |2 |Median |- |3 |Upper Quartile (75th percentile) |- |4 |Maximum value |} === MATLAB === In order to calculate quartiles in Matlab, the function ''quantile''(''A'',''p'') 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. <ref>{{Cite web|url=https://www.mathworks.com/help/stats/quantile.html|title=Quantiles of a data set β MATLAB quantile|website=www.mathworks.com|access-date=December 11, 2019}}</ref> {| class="wikitable" |+ !p !Output QUARTILE Value |- |0 |Minimum value |- |0.25 |Lower Quartile (25th percentile) |- |0.5 |Median |- |0.75 |Upper Quartile (75th percentile) |- |1 |Maximum value |} == See also == * [[Five-number summary]] * [[Range (statistics)|Range]] * [[Box plot]] * [[Interquartile range]] * [[Summary statistics]] * [[Quantile]] == References == {{reflist}} == External links == * [http://mathworld.wolfram.com/Quartile.html Quartile β from MathWorld] Includes references and compares various methods to compute quartiles * [http://mathforum.org/library/drmath/view/60969.html Quartiles] β From MathForum.org * [http://www.vias.org/tmdatanaleng/cc_quartile.html Quartiles] β An example how to calculate it [[Category:Summary statistics]] [[Category:4 (number)]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cbignore
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Plainlist
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use mdy dates
(
edit
)