The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
Constrained Quantile Regression with B-Splines (Degrees 1 to 4)
This package is available on CRAN.
If you use this package in your research, please cite:
@Article{Abbes2026,
author = {Alexandre Abbes},
title = {Constrained Quantile Regression with Cubic B-Splines under Shape Constraints},
year = {2026},
doi = {10.5281/zenodo.17427913}
}install.packages("BsplineQuantReg")# Using pak
pak::pak("alexandreabbes/BsplineQuantReg")
# Or using devtools
devtools::install_github("alexandreabbes/BsplineQuantReg")On Linux systems, the packages CVXR and
CLARABEL require the Rust compiler and Cargo package
manager to be installed.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/envcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/envrustc --version
cargo --versionAfter installing Rust and Cargo, restart R and install the package:
install.packages("BsplineQuantReg")Windows users do not need to install Rust separately. The package uses pre-compiled binaries available on CRAN.
| Package | Description | Constraint Type | Spline Degree |
|---|---|---|---|
| BsplineQuantReg (this package) | Quantile regression with Karlin-Studden constraints | Monotonicity, Convexity | 1 to 4 |
| quantreg | Classical quantile regression | None (linear programming) | Linear |
| cobs | Constrained B-splines | Monotonicity, Convexity | Linear, Quadratic |
The cobs package (Constrained B-Splines with linear or
quadratic splines) is the closest to this package.
This R package is intended for demonstration, prototyping, and educational purposes. Due to the current implementation (pure R with CVXR), the package is almost 5 times slower than its Python counterpart (benchmark test). B-spline quantile regression with constraints involves solving SOCP problems, and the R implementation does not yet leverage optimized linear algebra libraries.
Python version: https://pypi.org/project/BsplineQuantRegpy/
library(BsplineQuantReg)
# Generate sample data
set.seed(42)
x <- seq(0, 1, length.out = 100)
y <- 2*x + 0.5*sin(6*pi*x) + 0.05*rnorm(100)
knots <- quantile(x, probs = seq(0, 1, length.out = 10))
# Quantile regression with cubic spline and increasing constraint
fit <- SplineCubicQuant(x, y, knots, tau = 0.5, monot = 1)
# Evaluate the spline
x_eval <- seq(0, 1, length.out = 200)
#y_eval <- spline_eval(fit, x_eval) # deprecated now
y_eval <- fit(x_eval) # the fit is now callable# List available demos
demo(package = "BsplineQuantReg")
# Run a specific demo
demo("comprehensive", package = "BsplineQuantReg")
demo("temperature", package = "BsplineQuantReg")Please report issues on GitHub: https://github.com/alexandreabbes/BsplineQuantReg/issues ```
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.