--- title: "Theoretical Background" author: "Alexandre Abbes" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Theoretical Background} %\VignetteEncoding{UTF-8} %\VignetteEngine{knitr::rmarkdown} editor_options: markdown: wrap: 72 --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE, fig.width = 7, fig.height = 5) library(BsplineQuantReg) ``` ## Introduction This vignette provides a short theoretical background for the methods implemented in the `BsplineQuantReg` package. We cover two main topics: 1. **Quantile regression with shape constraints** using the Karlin-Studden SOCP formulation 2. **B-spline construction** via De Boor's recursion formula The theoretical framework combines: - Quantile regression (Koenker & Bassett, 1978) - B-spline approximation (de Boor, 1978) - Shape-constrained estimation via non-negative polynomials (Karlin & Studden, 1966) ## 1. Quantile Constrained Regression ### 1.1 Quantile Regression Quantile regression aims to estimate the conditional quantile function $Q_{Y|X}(\tau|x)$ for a given quantile level $\tau \in (0,1)$. The problem can be formulated as: $$\min_{f \in \mathcal{F}} \sum_{i=1}^{n} \rho_{\tau}(y_i - f(x_i))$$ where $\rho_{\tau}(u) = u(\tau - \mathbf{1}_{u < 0})$ is the check function (or pinball loss), and $\mathcal{F}$ is a class of functions (here, B-splines with shape constraints). ### 1.2 Shape Constraints The function $f(x)$ is assumed to satisfy one or more shape constraints: | Constraint | Mathematical Form | Meaning | |---------------------|---------------------------------|------------------| | Monotonicity | $f'(x) \geq 0$ (or $\leq 0$) | Increasing (or decreasing) | | Convexity | $f''(x) \geq 0$ (or $\leq 0$) | Convex (or concave) | | Third Derivative | $f'''(x) \geq 0$ (or $\leq 0$) | Controlling curvature evolution | ### 1.3 Karlin-Studden Characterization Karlin-Studden(1966) provide a characterization of non-negative polynomials on an interval. Papp and Elisadeth(2012) have translated this to an equivalent formulation with symetric matrices: for a polynomial $p(u)$ of degree $n$ on $[0,1]$: - **Even degree (**$n=2k$): $p(u) \geq 0$ iff there exist positive semidefinite matrices $\mathbf{X}$ and $\mathbf{Y}$ $(k+1)\times ((k+1)$ satisfying linear constraints with the coefficients of $p$. - **Odd degree (**$n=2k+1$): $p(u) \geq 0$ iff there exist positive semidefinite matrices $\mathbf{X}$ and $\mathbf{Y}$ $(k+1)\times ((k+1)$ satisfying linear constraints with the coefficients of $p$. For cubic splines (degree 3) (resp. For quartic splines (degree 4)) - Monotonicity: $f'(u) = a u^2 + b u + c \geq 0$ on each interval (resp Monotonicity: $f'(u) = a u^3 + b u^2 + c u + d \geq 0$ on each interval , convexity $f''(u)=a'u^2+b' u +c'\geq 0$) - These are polynomial of degree $2k$ (resp $2k+1$) with $k=1$. The positivity is characterized by a $2 \times 2$ positive matrix : SOCP constraint. Other constraints (convexity) have linear or constant expression in terms of the coefficients of $p$. ### 1.4 SOCP formulation and CVXR implementation The shape-constrained quantile regression problem can be written as: $$\min_{\boldsymbol{\alpha}, \mathbf{z}} \sum_{i=1}^{n} \rho_{\tau}(y_i - \mathbf{B}(x_i)^\top \boldsymbol{\alpha})$$ subject to: $$\text{SOC constraints for monotonicity, convexity, etc.}$$ $$\text{Linear constraints for third derivative, knots}$$ This is a **Second-Order Cone Program (SOCP)** that can be solved efficiently using interior-point methods. The package uses **CVXR** to model the SOCP problem: 1. **Variables**: B-spline coefficients $\boldsymbol{\alpha}$ and auxiliary variables $\mathbf{z}$ 2. **Objective**: Quantile loss function $\sum \rho_{\tau}(y_i - \mathbf{B}(x_i)^\top \boldsymbol{\alpha})$ 3. **Constraints**: - Karlin-Studden SOC constraints for monotonicity and convexity - Linear constraints for third derivative - Knot constraints for convexity/concavity The DCP (Disciplined Convex Programming) framework in CVXR ensures the problem is convex and translates it into a form suitable for solvers like CLARABEL, OSQP, ECOS, or SCS. ## 2. B-spline Construction with De Boor's Formula ### 2.1 B-spline Definition A B-spline of degree $d$ and knots \$t_0 \ - Koenker, R., & Bassett, G. (1978). Regression Quantiles. *Econometrica*, 46(1), 33-50. - Abbes, A. (2026). Quantile Regression with Cubic Polynomial Splines under Shape Constraints with Applications. Zenodo. ## Further Reading For more details on the implementation and examples, see the other vignettes: - `vignette("introduction", package = "BsplineQuantReg")` - `vignette("shape-constraints", package = "BsplineQuantReg")` - `vignette("basis-manipulation", package = "BsplineQuantReg")` \`\`\`