Bayes AI

Unit 8: Quantile Neural Networks for Reinforcement Learning and Uncertainty Quantification

Vadim Sokolov
George Mason University
Spring 2025

Course Page, Slides

Quantile Linear Regression

  • Quantile regression is a statistical method that extends traditional linear regression
  • Models the relationship between predictor variables and specific quantiles of the response variable, rather than just the conditional mean.
  • Provides a more comprehensive view of the relationship between variables across different parts of the distribution.

Mathematical Formulation

In linear regression, we model the conditional mean of the response variable Y given predictor variables X:

\[E(Y|X) = X\beta\]

In contrast, quantile regression models the conditional quantile function:

\[Q_Y(\tau|X) = X\beta(\tau)\]

where \(\tau\) is the quantile of interest (0 < \(\tau\) < 1), and \(\beta(\tau)\) are the regression coefficients for the \(\tau\)th quantile.

Estimation

Quantile regression estimates are obtained by minimizing the following objective function:

\[\min_{\beta} \sum_{i=1}^n \rho_\tau(y_i - x_i'\beta)\]

where \[\rho_\tau(u) = u(\tau - I(u < 0))\] is the tilted absolute value function[1][3].

Advantages and Applications

  1. Robustness to outliers
  2. Ability to capture heterogeneous effects across the distribution
  3. No assumptions about the distribution of the error terms

Quantile regression is particularly useful in:

  • Economics: Analyzing income disparities
  • Ecology: Studying species distributions
  • Healthcare: Developing growth charts
  • Finance: Assessing risk measures like Value at Risk (VaR)[4]

Example in R

Let’s demonstrate quantile regression using the mtcars dataset in R:

# Load required libraries
library(quantreg)
library(ggplot2)

# Load data
data(mtcars)

# Fit quantile regression models for different quantiles
quantiles <- c(0.1, 0.25, 0.5, 0.75, 0.9)
models <- lapply(quantiles, function(q) rq(mpg ~ wt, data = mtcars, tau = q))

# Create a plot
ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point() +
  geom_abline(intercept = coef(lm(mpg ~ wt, data = mtcars))[1],
              slope = coef(lm(mpg ~ wt, data = mtcars))[2],
              color = "red", linetype = "dashed") +
  geom_abline(intercept = sapply(models, function(m) coef(m)[1]),
              slope = sapply(models, function(m) coef(m)[2]),
              color = c("blue", "green", "purple", "orange", "brown")) +
  labs(title = "Quantile Regression: MPG vs Weight",
       x = "Weight (1000 lbs)", y = "Miles per Gallon") +
  theme_minimal()

# Print summary of median regression
summary(models[[3]])

This code fits quantile regression models for the 10th, 25th, 50th, 75th, and 90th percentiles of miles per gallon (mpg) based on car weight. The resulting plot shows how the relationship between weight and fuel efficiency varies across different quantiles of the mpg distribution[7][8].

Interpretation

The different slopes for each quantile indicate how the relationship between weight and mpg changes across the distribution. For instance, a steeper slope for higher quantiles might suggest that weight has a stronger negative effect on fuel efficiency for high-performance cars compared to more economical models[5].

Quantile regression thus provides a richer understanding of the data, revealing patterns that might be obscured when focusing solely on the conditional mean[2][6].