Kullback-Leibler divergence for each observation in Baysian quantile regression model
bayesKL(y, x, tau, M, burn)
vector, dependent variable in quantile regression
matrix, design matrix in quantile regression.
quantile
the iteration frequancy for MCMC used in Baysian Estimation
burned MCMC draw
Method to address the differences between the posterior distributions from the distinct latent variables in the model, we suggest the use of the Kullback- Leibler divergence as a more precise method of measuring the distance between those latent variables in the Bayesian quantile regression framework. In this posterior information, the divergence is defined as
$$K(f_{i}, f_{j}) = \int log(\frac{f_{i}(x)}{f_{j}{(x)}})f_{i}(x)dx$$
where \(f_{i}\) could be the posterior conditional distribution of \(v_{i}\) and \(f_{j}\) the poserior conditional distribution of \(v_{j}\). We should average this divergence for one observation based on the distance from all others, i.e,
$$KL(f_{i})=\frac{1}{n-1}\sum{K(f_{i}, f_{j})}$$
We expect that when an observation presents a higher value for this divergence, it should also present a high probability value of being an outlier. Based on the MCMC draws from the posterior of each latent vaiable, we estimate the densities using a normal kernel and we compute the integral using the trapezoidal rule.
More details please refer to the paper in references
Santos B, Bolfarine H.(2016)``On Baysian quantile regression and outliers,arXiv:1601.07344
bayesProb