j. m.c. santos silva university of surreyquantile regression: basics and recent advances j. m.c....

25
Quantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

Upload: others

Post on 21-Jul-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

Quantile regression: Basics and recent advances

J. M.C. Santos SilvaUniversity of Surrey

2019 UK Stata Conference06/09/19

1

Page 2: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

1. Summary

• Quantile regression (Koenker and Bassett, 1978) isincreasingly used by practitioners but it is still not part of thestandard econometric/statistics courses.

• Road map:• general introduction to quantile regression• two topics from recent research:

• models with time-invariant individual (“fixed effects”) effects• structural quantile function.

• I will present the approach to these problems proposed byMachado and Santos Silva (2019), and illustrate the use ofthe corresponding Stata commands xtqreg and ivqreg2.

2

Page 3: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

2. Conditional quantiles

• For 0 < τ < 1, the τ-th quantile of y given x is defined by

Qy (τ|x) = min{η|P(y ≤ η|x) ≥ τ}.

­0.4 ­0.2 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.1

0.2

0.3

0.4

0.5

0.6

y

Bernoulli probability mass function with Pr (y = 1) = 0.6

3

Page 4: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

3. Basics of quantile regression

• Quantile regression estimates Qy (τ|x).

• Throughout we assume linearity: Qy (τ|x) = x ′β (τ).

• With linear quantiles, we can write

y = x ′β (τ) + u (τ) ; Qu(τ)(τ|x) = 0.

• Note that the errors and the parameters depend on τ.

• For τ = 0.5 we have the median regression.

• We need to restrict the support of x to ensure that quantilesdo not cross.

4

Page 5: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

02

46

810

0 1 2 3 4 5x

5

Page 6: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

4. Inference

• The estimator of β (τ) is defined by

β̂ (τ) = argminb

1n

{∑yi≥x ′i b

τ∣∣yi − x ′i b∣∣+∑yi<x ′i b

(1− τ)∣∣yi − x ′i b∣∣} .

• The F.O.C. can be written as

1n ∑n

i=1

((τ − 1

((yi − x ′i β̂ (τ)

)< 0

)))xi = 0.

• β̂ (τ) is invariant to perturbations of yi that do not changethe sign of

(yi − x ′i β̂ (τ)

).

• β̂ (τ) can be estimated by linear programming (see qreg).

6

Page 7: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Asymptotic theory is non-standard because the objectivefunction is not differentiable.

• However, under certain regularity conditions, β̂ (τ) hasstandard properties:

√n(

β̂ (τ)− β (τ)) d→ N

(0,D−1AD−1

),

D = E[fu(τ) (0|xi ) xix ′i

], A = E

[(τ − 1 (u (τ)i ≤ 0))2xix ′i

].

• It is possible to estimate A and D under different assumptions(see qreg and qreg2).

7

Page 8: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

5. Comments

• The main advantage of quantile regression is theinformational gains they provide.

• Quantiles are “robust”measures of location and areestimated using a “robust”estimator.

• Quantiles and means have very different properties.

• Quantiles are not additive; the quantile of the sum is not thesum of the quantiles.

• Quantiles are equivariant to non-decreasing transformations;for example, if yi is non-negative with

Qyi (τ|xi ) = exp(x ′i β (τ)

),

then,Qln(yi )(τ|xi ) = x

′i β (τ) .

8

Page 9: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

6. Extensions

• The plain-vanilla quantile regression estimator has beenextended to different settings:

• Censored regression; Powell (1984)• Binary data; Manski (1975, 1985), Horowitz (1992)• Ordered data; M.-j. Lee (1992)• Count data; Machado and Santos Silva (2005)• Corner-solutions data; Machado, Santos Silva, and Wei (2016)• Clustering; Parente and Santos Silva (2016)

• Two areas of active research are:• quantile regressions with time-invariant individual ("fixed")effects, and

• structural quantile function.

9

Page 10: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

7. Quantiles via moments

• Consider a location-scale model

yi = x ′i β+(x ′i γ)ui ,

where xi and ui are independent and Pr (x ′i γ > 0) = 1.

• In this case the mean and all conditional quantiles are linear

Qy (τ|x) = x ′i β+(x ′i γ)

Qu(τ|xi )= x ′i β (τ)

β (τ) = β+ γQu(τ).

• In this model, the information provided by β, γ, and Qu(τ) isequivalent to the information provided by regression quantiles.

10

Page 11: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Machado and Santos Silva (2019) noted that, assumingE (U) = 0 and using the normalization E (|U |) = 1, β and γare identified by conditional expectations:

E [yi |xi ] = β0 + β1xi

E [|yi − β0 − β1xi | |xi ] = γ0 + γ1xi

• Qu(τ|xi ) can be estimated from the scaled errors

yi − β0 − β1xiγ0 + γ1xi

• This provides a way to estimate quantile regression using twoOLS regressions and the computation of a univariate quantile.

11

Page 12: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

8. Panel data

• Suppose now that we are interested in estimating

Qyit (τ|xit , ηi ) = x ′itβ (τ)+ η (τ)i , with i = 1, . . . , n; t = 1, . . . ,T .

• As in mean regression, “fixed effects” can be important.

12

Page 13: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Estimation of quantile regression with fixed effects is diffi cultbecause there is no transformation that can be used toeliminate the incidental parameters.

• Therefore, due to the incidental parameter problem,consistency requires that both n→ ∞ and T → ∞.

• For fixed T , the only realistic option is the "correlatedrandom effects" (Mundlak) estimator; see Abrevaya andDahl (2008).

• Roger Koenker (2004) and Canay (2011) proposed estimatorsbased on the assumption that η (τ)i = ηi but this goesagainst the spirit of quantile regression.

13

Page 14: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Kato, Galvão, and Montes-Rojas (2012) studied the propertiesof quantile regression in a model where the fixed effects areexplicitly included as dummies.

• The estimator is consistent and asymptotically normal whenboth n→ ∞ and T → ∞ with n2 [ln (n)]3 /T → 0.

• This is an issue because in many applications n is much largerthan T (e.g. for T = 40, n = 100, n2 [ln (n)]3 /T = 24, 416).

• An alternative is to use the quantiles-via-moments estimator.

14

Page 15: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Consider the location-scale model for panel data

yit = αi + x ′itβ+ (δi + x′itγ)uit

η (τ)i = αi + δiQu(τ), β (τ) = β+ γQu(τ),

where xi and ui are independent and Pr ((δi + x ′itγ) > 0) = 1.

• Estimation is performed using two fixed effects regressions(xtreg) and computing a univariate quantile.

• Consistency requires (n,T )→ ∞ with n = o(T ).

• For fixed T the estimator will have a bias but:

• simulations suggest that the bias is negligible for n/T ≤ 10;• the bias can be removed using jackknife.

• The estimator is implemented in the xtqreg command(available from SSC)

15

Page 16: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

xtqreg

xtqreg depvar [indepvars] [if] [in] [, options]

quantile(#[#[# ...]]): estimates # quantile; default isquantile(.5)

id: specifies the variable defining the panel

ls: displays the estimates of the location and scaleparameters

16

Page 17: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

9. Endogeneity

• Suppose that we have a structural relationship defined by

y = dα+ x ′β+ u,

d = δ (x , z , v)

where v may not be independent of u

• We are interested in

Sy (τ|d , x) = dα (τ) + x ′β (τ) ,

the structural quantile function such that:

• Pr [y < Sy (τ|d , x) |z , x ] = τ,

• Sy (τ|d , x) = Qy (τ|z , x) 6= Qy (τ|d , x).

17

Page 18: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Chernozhukov and Hansen (2008) propose an estimator ofSY (τ|d , x) based on the observation that

Qy−dα(τ) (τ|z , x) = x ′β (τ) + zγ (τ)

with γ (τ) = 0.• We can implement the estimator by:

• estimating β (τ) and γ (τ) for a range of values of α (τ)

• and choosing as estimates the ones corresponding to the valueof α (τ) for which γ (τ) is in some sense closer to zero.

• Chernozhukov and Hansen (2008) prove the consistency andasymptotic normality of the estimator.

• The estimator is diffi cult to implement when there aremultiple endogenous variables, but there have been a numberof recent developments on this.

18

Page 19: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Again, the quantile-via-moments estimator can be useful.• Consider a location-scale structural relationship

y = dα+ x ′β+(dδ+ x ′γ

)u, d = δ (x , z , v) ,

where v may not be independent of u but u is independent ofx and z .

• Because Sy (τ|d , x) is such that Pr [y < Sy (τ|d , x)|z , x ] = τ,

Sy (τ|d , x) = dα+ x ′β+(dδ+ x ′γ

)Qu(τ)

= d (α+ δQu(τ)) + x (β+ γQu(τ)) .

19

Page 20: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• GMM can be used to estimate the structural parameters:

E[(

yi − dα− x ′βdδ+ x ′γ

)∣∣∣∣ zi] = 0,E[(|yi − dα− x ′β|dδ+ x ′γ

− 1)∣∣∣∣ zi] = 0.

• Qu(τ) can be estimated from the standardized errors(yi − d α̂− x ′ β̂

)/(d δ̂+ x ′γ̂

).

• The estimator has the usual properties.

• The estimator is implemented in the ivqreg2 command(available from SSC)

20

Page 21: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

ivqreg2

ivqreg2 depvar [indepvars] [if] [in] [, options]

quantile(#[#[# ...]]): estimates # quantile; default isquantile(.5)

instruments(varlist): list of instruments, including controlvariables; by default no instruments are used andrestricted quantile regression is performed

ls: displays the estimates of the location and scaleparameters

21

Page 22: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

10. Final notes

• Quantile regression can be very useful and it is now easy toimplement in a variety of cases.

• In some contexts, however, quantile regression can bechallenging.

• The Method of Moments-Quantile Regression estimator canbe useful in some of these cases.

• xtqreg and ivqreg2 make it easy to estimate quantileregressions with “fixed effects”or endogenous variables.

22

Page 23: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

References

• Abrevaya, J. and Dahl, C.M. (2008). “The Effects of BirthInputs on Birthweight,” Journal of Business & Economic Statistics,26, 379-397.

• Canay, I.A. (2011). “A Simple Approach to Quantile Regressionfor Panel Data,”Econometrics Journal, 14, 368-386.

• Chernozhukov, V. and Hansen, C. (2008). “InstrumentalVariable Quantile Regression: A Robust Inference Approach,”Journal of Econometrics, 142, 379—398.

• Horowitz, J.L. (1992). “A Smooth Maximum Score Estimatorfor the Binary Response Model”, Econometrica, 60, 505-531.

• Kato, K., Galvão, A.F. and Montes-Rojas, G. (2012).“Asymptotics for Panel Quantile Regression Models with IndividualEffects,” Journal of Econometrics, 170, 76—91.

23

Page 24: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Koenker, R. (2004). “Quantile Regression for LongitudinalData,” Journal of Multivariate Analysis 91, 74—89.

• Koenker, R. and Bassett Jr., G.S. (1978). “RegressionQuantiles,”Econometrica, 46, 33-50.

• Lee, M.-j. (1992). “Median Regression for Ordered DiscreteResponse,” Journal of Econometrics, 51, 59-77.

• Machado, J.A.F. and Santos Silva, J.M.C. (2005), “Quantiles forCounts”, Journal of the American Statistical Association, 100,1226-1237.

• Machado, J.A.F., Santos Silva, J.M.C., and Wei, K. (2016),“Quantiles, Corners, and the Extensive Margin of Trade,”European Economic Review, 89, 73—84.

24

Page 25: J. M.C. Santos Silva University of SurreyQuantile regression: Basics and recent advances J. M.C. Santos Silva University of Surrey 2019 UK Stata Conference 06/09/19 1

• Machado, J.A.F. and Santos Silva, J.M.C. (2019), “Quantiles viaMoments,” Journal of Econometrics, forthcoming.

• Manski, C.F. (1975). “Maximum Score Estimation of theStochastic Utility Model of Choice”, Journal of Econometrics, 3,205-228.

• Manski, C.F. (1985). “Semiparametric Analysis of DiscreteResponse: Asymptotic Properties of the Maximum ScoreEstimator”, Journal of Econometrics, 27, 313-333.

• Parente, P.M.D.C. and Santos Silva, J.M.C. (2016). “QuantileRegression with Clustered Data,”Journal of Econometric Methods,5, 1-15.

• Powell, J.L. (1984). “Least Absolute Deviation Estimation forthe Censored Regression Model,” Journal of Econometrics, 25,303-325.

25