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.
The R-package “Quantile regression with B-splines under shape constraints” is intended to perform quantile regression with polynomial splines. It follows the method described in Abbes(2025) doi:10.5281/zenodo.17427913, and initiated by He and Shi (1998) for quadratic splines, on the original idea of Koenker and Basset for linear regression.
n_points <- 50
xtab = ((0:(n_points)) / (n_points))
# simple pscillating data
#ytab<- -3 * xtab +sin(3*2*xtab*3.14)+ 0.2 * rnorm(n_points+1)
#ytab= <- 2* xtab + 0.5 * sin(6 * pi * xtab) + 0.1 * rnorm(n_points+1)
ytab <- xtab * (1 - xtab) + 0.1 * rnorm(n_points + 1)
kn <- 8
n = 7
monot1 = c(rep(1, n), rep(0, (12 - n)))
monot2 = rep(1,12)
knot <- ((0:(kn + 5)) / (kn + 5))
res <- quantile_spline(
xtab = xtab,
ytab = ytab,
knot,
tau = 0.5,
monot = 0,
degree = 3,
verbose = FALSE
)
res_part_croissant <- quantile_spline(
xtab = xtab,
ytab = ytab,
knot = knot,
tau = 0.5,
degree = 3,
monot = monot1,
convcons = 0,
verbose = FALSE
)
#> Not enough monotonicity constraints, completing with 0
res_croissant <- quantile_spline(
xtab = xtab,
ytab = ytab,
knot = knot,
tau = 0.5,
degree = 3,
monot = 1,
convcons = 0,
verbose = FALSE
)
par(mfrow = c(1, 3))
x_eval=(0:200)/200
y_sans = spline_eval(res, x_eval)
y_part_croiss = spline_eval(res_part_croissant, x_eval)
y_croiss = spline_eval(res_croissant, x_eval)
plot(
xtab,
ytab,
pch = 16,
cex = 0.5,
col = "black",
main = c("Without constraint")
)
lines(x_eval, y_sans, lwd = 2)
plot(
xtab,
ytab,
pch = 16,
cex = 0.5,
col = "black",
main = c("Mixed mootone :\n global increasing constraints
"
)
)
lines(x_eval, y_croiss, lwd = 2)
plot(
xtab,
ytab,
pch = 16,
cex = 0.5,
col = "black",
main = c("Mixed mootone :\n increasing constraints
\n on the first inter-knots"
)
)
lines(x_eval, y_part_croiss, lwd = 2) The initial version with cubic splines is now augmented with splines of degree 0 to 4 for constrained regression, and any degree for regression without monotone constraints.
degrees_comparison — simultaneous
comparison of constraints across degrees 1, 2, 3, and 4.Constraints for degree 3 (monotone), degree 4 (monotone and convex) and degree 5 (convex) use the Karlin–Studden SOCP characterization.
theoretical_background,
shape_constraintsmonotonicity_basic — monotonicity constraintsconvexity — convexity and concavity constraintstemperature — temperature anomaly analysis: uniform
increasing vs mixed constraints (decreasing 1956–1973 only)temperature2 — temperature anomaly analysis with
alternative constraint configurationslogistic — quantile regression test on a logistic
functioncomprehensive — comprehensive test of various
constraints on an oscillating functionThird-derivative constraints are supported for degrees 3 and 4.
demo_der3 — demonstration of
third-order derivative constraints.All B-spline and polynomial functions have been rewritten for consistency. The package provides an original B-spline library for:
all based on De Boor’s theory.
polynomial_library,
bspline_basis_manipulationDifferentiation of B-splines can be performed either on the spline (polynomial differentiation) or on the basis.
derivative2 — coherence of the
derivative functions.The library also extends to multiple knots to handle singularities, robustly, including for constrained regression.
shock — regression with discontinuity and derivability
singularityshock_basis — same as shock, with singular
B-spline basis display# From CRAN:
# install.packages("BsplineQuantRegGui")
# Or from GitHub:
# install.packages("remotes")
# remotes::install_github("<user>/BsplineQuantRegGUI")
# Launch:
# BsplineQuantRegGui::run_app()The GUI lets you:
An equivalent Python package is available at https://pypi.org/project/BsplineQuantRegpy/.
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.