11.2: Quantile Regression
- Page ID
- 57759
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)The previous section covered median regression. There, we motivated the method by focusing on minimizing the sum of the absolute value of the residuals. It turns out that this is equivalent to estimating the conditional median of the dependent variable (hence its name). In other words, the line of best fit is the line that best goes through the medians at each x-value.
Compare this to how we motivated ordinary least squares back in Chapter 3: by minimizing the sum of the squared errors. This is equivalent to estimating the conditional mean of the dependent variable.
In other words, OLS estimates \(E[Y \ |\ x]\) while median regression estimates \(\mathbf{Med}\left[Y \ |\ x\right]\), for want of better notation. (Perhaps \(Q_2\left[Y \ |\ x\right]\) or \(P_{50}\left[Y \ |\ x\right]\) would be better notation.)
There is absolutely no reason we need to focus only on the conditional median of the dependent variable (conditional on the independent variable). We may want to focus on other percentiles, like the 10th percentile or 90th. This happens a lot in sociology when studying poverty (10th percentile of income) or education (90th percentile of academic achievement). The idea behind the fitting is the same (Koenker and Hallock 2001). The R function is also the same. The only difference is that you need to specify the quantile. To see this, let us see a couple familiar examples.
Modeling the Violent Crime Rate
What is the relationship between the violent crime rates in 2000 and 1990 in the crime data at the 10th percentile?
Solution:
Here is the code the perform this estimation:
mod5 = rq(vcrime00~vcrime90, tau=0.10) summary(mod5)
The following is the output:
Call: rq(formula = vcrime00 ~ vcrime90, tau = 0.1)
tau: [1] 0.1
Coefficients:
coefficients lower bd upper bd
(Intercept) 40.29964 -14.80397 100.38757
vcrime90 0.55616 0.38948 0.60422
Thus, for those states near the 10th percentile (\(\tau=0.10\)), the effect of the 1990 violent crime rate on the 2000 is between 0.389 and 0.604, with a point estimate of 0.556. This is only a little different from the median results, which suggests those states that are less crime-ridden (at the 10th percentile) still followed the same "rule" with respect to violent crime rate changes between 1990 and 2000.
\(\blacksquare\)
Modeling the Property Crime Rate
What is the relationship between the property crime rates in 2000 and 1990 in the crime data at the 90th percentile?
Solution:
Here is the code to perform this estimation:
mod6 = rq(pcrime00~pcrime90, tau=0.90) summary(mod6)
The following is the output:
Call: rq(formula = pcrime00 ~ pcrime90, tau = 0.9)
tau: [1] 0.9
Coefficients:
coefficients lower bd upper bd
(Intercept) 1761.72465 327.54503 2436.15997
pcrime90 0.53326 0.40262 0.84489
Thus, for those near the 90th percentile (\(\tau=0.90\)), the effect of the 1990 violent crime rate on the 2000 is between 0.403 and 0.845, with a point estimate of 0.533. This differs a little from the median results, which suggests those states that are more (property) crime-ridden (at the 90th percentile) followed a similar "rule" with respect to violent crime rate changes between 1990 and 2000. Their rates dropped slightly more than did the typical (median) state.
\(\blacksquare\)
By the way, Figure \(\PageIndex{1}\) is a graphic of the deciles from 10 to 90% for the relationship between property crime rates in 1990 and 2000. Note that the effect does appear to change as one looks at middle-rate states. The highest levels, quantiles 80 and 90, are very similar in effect to the lower levels, quantile 10 and 20. However, those states near quantile 50 seem to have a greater slope. If we had only looked at the median, we would have only reported these steeper effects. This may have overstated the effect.
Modeling the Property Crime Rate using Wealth
What is the relationship between the state's wealth in 1990 and the property crime rate in 2000? Show the effects at the first, second, and third quartiles.
Solution.
We will use the GSP per capita as a proxy measure of wealth in the state. I leave the coding to you. Here is the appropriate output for the median:
Call: rq(formula = pcrime00 ~ gspcap90)
tau: [1] 0.5
Coefficients:
coefficients lower bd upper bd
(Intercept) 3061.50674 2383.13082 4989.55600
gspcap90 0.02403 -0.08109 0.04996
Interpreting the table indicates that there is no significant evidence that there is a relationship between the average wealth in 1990 and the property crime rate in 2000 for the median state (the confidence interval contains $0$).
For the first and third quartile, the conclusions will be the same. As both confidence interval contain both positive and negative numbers, we are unsure of the relationship between these two variables.
\(\blacksquare\)
I leave it as an exercise for you to show that ordinary least squares indicates a statistical significant relationship (\(\mathrm{p-value}= 0.0475\)). It also provides a point estimate of that relationship of \(b_1 = 0.03025\)).
Figure \(\PageIndex{2}\) provides the results for all deciles. Note that the slopes also seem to vary according to the quantile examined. Thus, the effect of wealth on property crime rates seem to be a function of those property crime rates. The lowest quantiles suggest the steepest effect. However, performing the analysis shows that the relationship is not statistically significant at the \(\alpha = 0.05\) level. In other words, we were unable to detect a relationship.
The Ultimate Question
So, is there a relationship between average wealth in 1990 and the property crime rate in 2000? One thing we know is that if there is a relationship, then it is minor. It is not surprising that median regression does not detect a relationship while ordinary least squares does. Median regression, like all statistics based on the median (ranks), has a lower power than ordinary least squares (these statistics require Normality).
So, the answer to the ultimate question is "I'm not sure."
Ultimately, this is unsatisfying. It is also reality. By using both OLS and median regression, we have a better understanding of the relationship between average wealth and property crime rates. That is the goal of statistics, not coming up with binary answers.


