Estimating Quantile on Quantile Regression In Stata

Quantile on Quantile regression is a simple regression of one independent variable in quantile regression method. In this method several quantile positions are provided for independent variable and then quantile regressed against several quantile positions of dependent variable. This this regression provides distribution robust effects.

You can learn its interpretations in following papers.

Hassan, M. S., Iqbal, M., & Arshed, N. (2021). Distribution-based effects of disaggregated GDP and environmental quality—a case of quantile on quantile estimates. Environmental Science and Pollution Research28(22), 28081-28095.

Arshed, N., Saeed, M. I., Abdulghafor, S. C., & Hassan, M. S. (2023). Promoting Education Quality in Curbing Business Crime Costs: A Quantile Analysis. Journal of Social Sciences Review3(1), 138-148.

Following are the codes.

clear
use “C:\Users\LENOVO\Desktop\qantile PMG model\quantile on quantile on stata\data.dta”
tsset time
* Generate scalar values from 5 to 95 with a jump of 5 for quantile values
 xtile mal_group = mal, nq(100)
 * Create a matrix to save the QQR estimates
matrix QQR_coef = J(19, 19, .)
capture postutil clear
tempfile holding
postfile handle qqrji using `holding’
forvalues i = 1/19 {
local tau_indep = `i’ *5
   forvalues j = 1/19 {
local tau_val = `j’*5
    quietly qreg pak mal  if mal_group < `tau_indep’, quantile(`tau_val’)
local effect = _b[mal]
display “Quantile value of Indep. var: ” `tau_indep’ ” & dep var: ” `tau_val’ ” have value: ” `effect’
post handle (`effect’)
}
}
postclose handle
use `holding’, clear
generate PercentileX = ceil(_n / 19) *5
egen obs_in_group = seq(), from(1) to(19)
gen PercentileY = obs_in_group * 5
gen QuantileEffect = qqrji
 twoway (contour QuantileEffect PercentileY PercentileX)
 reshape wide qqrji, i(PercentileY) j(PercentileX)

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top