Statistical model reference
Bayesian Quantile Regression
Review when to use this method, its data requirements, implementation patterns, and interpretation guidance.
Description
Extension of quantile regression that estimates conditional quantiles (e.g., median, 90th percentile) using Bayesian inference with asymmetric Laplace likelihood. Provides full posterior distributions for quantile-specific effects, allowing uncertainty quantification in tail relationships. Robust to outliers and heteroscedasticity.
Use Cases
- heteroscedastic_data
- non-normal_residuals
- tail_risk_analysis
- censored_data
Requirements
- Sample Size: small (n > 50), medium, large
- Missing Data: none, random
- Data Distribution: asymmetric_laplace, heavy_tailed
- Relationship Type: linear, non_linear
Variable Types
Dependent Variables
- continuous
- censored
Independent Variables
- continuous
- categorical
Implementation
import pymc as pm
with pm.Model() as qreg:
# Priors
beta = pm.Normal('beta', mu=0, sigma=10, shape=X.shape[1])
# Likelihood
quantile = 0.9 # Target quantile
mu = pm.math.dot(X, beta)
pm.AsymmetricLaplace('y_obs', mu=mu, b=1, kappa=quantile, observed=y)
Documentation
library(quantreg)
library(brms)
fit <- brm(
bf(y ~ x1 + x2, quantile = 0.9),
data = df,
family = asym_laplace(),
chains = 4
)
Documentation
QUANTREG y WITH x1 x2
/QUANTILE 0.9
/PRINT PARAMETERS.
Documentation
proc quantreg data=mydata;
model y = x1 x2 / quantile=0.9;
run;
Documentation
qreg y x1 x2, quantile(0.9)
Documentation
Synthetic Data Example
Simulated dataset with heteroscedastic errors and varying quantile effects
R Code for Data Generation and Analysis
set.seed(123)
n <- 300
x1 <- rnorm(n)
x2 <- rnorm(n)
# True effects differ by quantile
y <- 2 + 0.5*x1 + (1 + 0.3*x2)*rnorm(n)
df <- data.frame(y, x1, x2)
Copy this code into your R environment to generate synthetic data and perform analysis with this model.
Expected Analysis Results
Console Output
> summary(fit)
Family: asym_laplace
Link function: mu = identity
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI
Intercept 2.01 0.12 1.78 2.25
x1 0.52 0.10 0.33 0.71
x2 0.15 0.09 -0.03 0.32
Quantile: 0.9
Sample Size: 300
Visualizations
These results are from running the R code on synthetic data. Your actual results may vary depending on your data.
Interpretation Guide
Need help interpreting the results of your Bayesian Quantile Regression analysis? Our comprehensive interpretation guide explains:
- How to read and understand model outputs
- Interpreting coefficients and effect sizes correctly
- Understanding diagnostic plots and visualizations
- Common pitfalls and how to avoid them
- Making valid conclusions from your analysis