RollingQuantile / Computation Layer
Calculate rolling quantiles (percentiles) over a sliding window. Similar to pandas.rolling().quantile() or R's roll_quantile().
Mathematical form: Find value where: where is the desired quantile.
Common applications:
- Risk metrics (Value at Risk)
- Performance analytics (percentile ranking)
- Statistical quality control
- Environmental threshold monitoring
- Load balancing metrics
- Population distribution analysis
- Anomaly detection
Note: Supports different interpolation methods for precise quantile calculation.
Select
columnThe numeric column to compute rolling quantiles for. Common uses:
- Financial returns (risk metrics)
- Response times (performance analysis)
- Quality measurements (process control)
- Population metrics (distribution analysis)
- Environmental data (threshold monitoring)
Quantile
f64Target quantile between 0 and 1. Common values:
- 0.25: First quartile (25th percentile)
- 0.50: Median (50th percentile)
- 0.75: Third quartile (75th percentile)
- 0.95: 95th percentile (common in risk metrics)
- 0.99: 99th percentile (extreme values analysis)
WindowSize
u32Number of observations in sliding window. Common choices:
- 100: Percentile over recent 100 observations
- 250: Trading year for financial analysis
- 1440: Daily analysis of minute data
Larger windows provide more stable quantile estimates.
Interpolation
enumMethod to calculate quantile when exact value doesn't exist. Choose based on:
- Data type (discrete vs continuous)
- Precision requirements
- Performance needs
- Conservative vs liberal estimates
Select nearest value to theoretical quantile. Fastest method, but can be jumpy. Best for discrete data or when exact values must come from input.
Select next value above theoretical quantile. Conservative approach, useful for upper bound estimates and risk analysis.
Select next value below theoretical quantile. Less conservative approach, useful for lower bound estimates and minimum thresholds.
Average of higher and lower values. Balanced approach, smooths discrete jumps while maintaining relationship to actual data points.
Linear interpolation between nearest values. Most precise for continuous data, provides smooth transitions between quantile values.
Weights
[f64, ...]Optional weights for window values. Must match window size if provided. Uses:
- Time-weighted percentiles
- Importance-weighted distributions
- Custom probability weightings
Affects distribution and resulting quantile calculation.
MinPeriods
oneofRequire complete windows for quantile calculation. Ensures statistical reliability by only computing when full distribution is available. Important for accurate percentile calculations.
Center
boolWindow label position. When true
, aligns to window center; when false
, to end. Effects:
true
: Better for historical distribution analysisfalse
: Better for real-time percentile monitoring
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.