maths.freeStatistics & Probability › Describing data › Quartile

Quartile

In statistics, quartiles are a type of quantiles which divide the number of data points into four parts, or quarters, of more-or-less equal size.

Quartile

In statistics, quartiles are a type of 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 (Q1) is defined as the 25th percentile, where the lowest 25% data lies below this point. It is also known as the lower quartile.
  • The second quartile (Q2) is the median of a data set; thus 50% of the data lies below this point.
  • The third quartile (Q3) is the 75th percentile, where the lowest 75% data lies below this point. It is also known as the upper quartile.

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 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 generally not the same between adjacent quartiles (i.e. usually (Q3 - Q2) ≠ (Q2 - Q1)). Interquartile range (IQR) is defined as the difference between the 75th and 25th percentiles or Q3 - Q1. 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.

Continuous probability distributions

If we define a continuous probability distributions as \(P(X)\) where \(X\) is a real valued random variable, its cumulative distribution function (CDF) is given by

\(F_X(x) = P(X \leq x)\).

The CDF gives the probability that the random variable \(X\) is less than or equal to the value \(x\). Therefore, the first quartile is the value of \(x\) when \(F_X(x) = 0.25\), the second quartile is \(x\) when \(F_X(x) = 0.5\), and the third quartile is \(x\) when \(F_X(x) = 0.75\). The values of \(x\) can be found with the quantile function \(Q(p)\) where \(p = 0.25\) for the first quartile, \(p = 0.5\) for the second quartile, and \(p = 0.75\) for the third quartile. The quantile function is the inverse of the cumulative distribution function if the cumulative distribution function is monotonically increasing because the 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. 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 (\(Q_3 - Q_1\)), 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 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 (\(Q_1\) and \(Q_3\) respectively) and the interquartile range (\(\textrm{IQR} = Q_3 - Q_1\)) as outlined above, then fences are calculated using the following formula:

\(\text{Lower fence} = Q_1 - (1.5 \times \mathrm{IQR})\)

\(\text{Upper fence} = Q_3 + (1.5 \times \mathrm{IQR})\)

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 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.

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.

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.

Nyt sinä Yksikään laskin ei ratkaise tätä, mutta sen osat ovat yhtä totta. Kokeile alla olevaa tai kirjoita omasi.

Pidä oma työsi

Vapaa tili lisää muistiinpanoja jokaiseen oppituntiin, muistiinpanoja siitä, mitä olet saanut päätökseen, ratkaistuja ongelmiasi yhdessä paikassa ja ohjaajaa, jolta voit kysyä tästä sivusta. Matematiikka on kaikille avoin, kirjautunut tai ei.

Rekisteröidy Kirjautuminen

Symbolit, joita käytetään täällä

Napauta symbolia koko määrittelyn, kuvan ja sen jokaisen kirjaimen osalta.

Kysymyksiä

Mean or median, which should I use?

Median when the data have outliers or a long tail (incomes, house prices); mean when the data are roughly symmetric and you want every value to count. Report both if they disagree. The gap is itself information.

What does a p-value actually say?

The probability of seeing data at least this extreme if the null hypothesis were true. It is not the probability that the null hypothesis is true.

Why divide by n − 1 for the sample variance?

The sample mean sits closer to the sample than the true mean does, so squared deviations from it are slightly too small on average; dividing by n − 1 instead of n corrects the bias.

Osaa tästä sivusta on muokattu Wikipedia (CC BY-SA 4.0). Tässä on tiivistetty ja selitetty uudelleen, virheet ovat meidän.

Lisää Statistics & Probability