A few days ago the
Wolfram Function Repository entry QuantileRegression
was approved.
The resource description page has many of the topics discussed in the live-coding sessions on Quantile regression.
Here is the code result of the neat examples section:
SeedRandom[20];
distData = Table[{x, Exp[-x^2] + RandomVariate[NormalDistribution[0, .15 \[Sqrt](Abs[1.5 - x]/1.5)]]}, {x, -3, 3, .01}];
Grid[Table[
Block[{tempData = RandomSample[distData, 100], data, probs},
data = Join[tempData, {#[[1]], -#[[2]]} & /@ tempData];
data = SortBy[Transpose[Rescale /@ Transpose[data]], #[[1]] &];
probs = {0.02, 0.48, 0.52, 0.98};
qFuncs =
ResourceFunction["QuantileRegression"][data, 5, probs, Method -> {LinearProgramming, Method -> "InteriorPoint",Tolerance -> 10^(-2)}];
ListPlot[Prepend[(Transpose[{data[[All, 1]], #1 /@ data[[All, 1]]}] &) /@ qFuncs, data],
Joined -> Prepend[Table[True, Length[probs]], False],
Filling -> Prepend[Table[(i + 1) -> {i + 2}, {i, Length[probs] - 1}], 1 -> None], Frame -> True, FrameTicks -> False, Axes -> False,
ImageSize -> Small, AspectRatio -> 1]], 3, 3]]