While estimating quantile on quantile regressions, one must also provide statistical evidence regarding quantile on quantile associations. This blog provides the tutorial to estimate associations changing across quantile on quantile.
The tutorial is available at: https://youtu.be/Gc-CdcnFKrI
Codes are as under:
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
capture xtile mal_group = mal, nq(100)
capture xtile pak_group = pak, nq(100)
capture postutil clear
tempfile holding
postfile handle qqcji using `holding’
forvalues i = 1/19 {
local tau_indep = `i’ *5
forvalues j = 1/19 {
local tau_val = `j’*5
corr pak mal if mal_group < `tau_indep’ & pak_group < `tau_val’
mat M = r(C)
local test = M[2,1]
display “Quantile value of Indep. var: ” `tau_indep’ ” & dep var: ” `tau_val’ ” have value: ” `test’
post handle (`test’)
}
}
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 QuantileCorr = qqcji
twoway (contour QuantileCorr PercentileY PercentileX), scheme(sj) ytitle(Pakistan Index) xtitle(Malaysia Index)