Search Shortcut cmd + k | ctrl + k
anofox_forecast

Statistical timeseries forecasting in DuckDB. Supports ARIMA, ETS, Theta, TBATS, MFLES, MSTL, Croston, GARCH, and other models.

Maintainer(s): sipemu

Compatibility Matrix

This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.

Platform 1.4.4 1.4.5 1.5.5 1.5.6 2.0.0
Linux AMD64
Linux ARM64
macOS AMD64
macOS ARM64
Windows AMD64
Windows ARM64
WebAssembly

Installing and Loading

INSTALL anofox_forecast FROM community;
LOAD anofox_forecast;

Added Functions

function_name function_type description comment examples
_ts_auto_ensemble_inspect_native scalar NULL NULL  
_ts_conformal_calibrate scalar NULL NULL  
_ts_conformal_from_pairs scalar NULL NULL  
_ts_coverage_native table NULL NULL  
_ts_cv_folds_native table NULL NULL  
_ts_cv_forecast_native table NULL NULL  
_ts_cv_hydrate_native table NULL NULL  
_ts_cv_split_native table NULL NULL  
_ts_data_quality scalar NULL NULL  
_ts_detect_changepoints_bocpd scalar NULL NULL  
_ts_detect_changepoints_by_native table NULL NULL  
_ts_detect_periods scalar NULL NULL  
_ts_diff scalar NULL NULL  
_ts_ensemble_inspect_native scalar NULL NULL  
_ts_features_native table NULL NULL  
_ts_fill_forward_native table NULL NULL  
_ts_fill_gaps_native table NULL NULL  
_ts_fill_nulls_mean scalar NULL NULL  
_ts_forecast scalar NULL NULL  
_ts_forecast_ensemble_native scalar NULL NULL  
_ts_forecast_exog scalar NULL NULL  
_ts_forecast_explain_scalar scalar NULL NULL  
_ts_forecast_inspect_scalar scalar NULL NULL  
_ts_forecast_native table NULL NULL  
_ts_forecast_panel_native table NULL NULL  
_ts_forecast_scalar scalar NULL NULL  
_ts_forecast_var_native table NULL NULL  
_ts_future_dates scalar NULL NULL  
_ts_is_constant scalar NULL NULL  
_ts_mase_native table NULL NULL  
_ts_metrics_native table NULL NULL  
_ts_mstl_decomposition scalar NULL NULL  
_ts_mstl_decomposition_native table NULL NULL  
_ts_quantile_loss_native table NULL NULL  
_ts_rmae_native table NULL NULL  
_ts_stats scalar NULL NULL  
_ts_stats_by_native table NULL NULL  
_ts_stats_with_dates scalar NULL NULL  
anofox_fcst_ts_adf scalar Augmented Dickey-Fuller (ADF) unit-root test (prefixed alias). Returns STRUCT(statistic, p_value, lags, is_stationary, cv_1pct, cv_5pct, cv_10pct). NULL [anofox_fcst_ts_adf(LIST(y ORDER BY ds))]
anofox_fcst_ts_adf_by table_macro ADF stationarity test per group. Returns STRUCT(statistic, p_value, lags, is_stationary, cv_1pct, cv_5pct, cv_10pct) per group. AIC lag selection; pass max_lags:=N to override automatic lag selection. regression:='c' (constant, default) or regression:='ct' (constant + trend). NULL [SELECT group_col, (adf).statistic, (adf).p_value FROM ts_adf_by('sales', product_id, ds, y, regression := 'ct')]
anofox_fcst_ts_analyze_peak_timing table_macro Analyzes peak timing variability for a single time series. NULL [SELECT * FROM ts_analyze_peak_timing('sales', product_id, date, qty, 7)]
anofox_fcst_ts_analyze_peak_timing_by table_macro Analyzes peak timing variability for each group, returning timing statistics and stability score. NULL [SELECT * FROM ts_analyze_peak_timing_by('sales', product_id, date, qty, 7)]
anofox_fcst_ts_analyze_seasonality scalar Analyzes seasonal patterns in detail, returning amplitude, phase, strength, and period information. NULL [ts_analyze_seasonality(LIST(ts ORDER BY ts), LIST(value ORDER BY ts))]
anofox_fcst_ts_analyze_seasonality scalar Analyzes seasonal patterns in detail, returning amplitude, phase, strength, and period information. NULL [ts_analyze_seasonality(LIST(value ORDER BY date), 7)]
anofox_fcst_ts_auto_ensemble_inspect_by table_macro Returns selected member names and in-sample MSE scores for an AutoEnsemble per series. weight = 1/k for Mean combination; NULL for all other methods (crate 0.15.3 limitation — inner AutoEnsemble combination weights are not accessible via public API). rank = 1..k by ascending MSE (best = 1). score = in-sample MSE from AutoEnsemble.all_scores(). NULL [SELECT * FROM ts_auto_ensemble_inspect_by('sales', id, ds, y, top_k := 3, combination_method := 'mean')]
anofox_fcst_ts_bias scalar Computes mean forecast bias (mean error) between actual and predicted value arrays. NULL [ts_bias(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
anofox_fcst_ts_bias_by table_macro Computes mean forecast bias between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_bias_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
anofox_fcst_ts_bootstrap_intervals scalar Generates bootstrap prediction intervals by resampling historical residuals. Returns STRUCT(point[], lower[], upper[], coverage). NULL [ts_bootstrap_intervals(residuals, point_forecast, 1000, 0.90, 42)]
anofox_fcst_ts_bootstrap_quantiles scalar Generates bootstrap quantile intervals by resampling historical residuals. Returns STRUCT(point[], quantiles[], values[][]). NULL [ts_bootstrap_quantiles(residuals, point_forecast, 1000, [0.1, 0.5, 0.9], 42)]
anofox_fcst_ts_check_leakage table_macro Audits a cross-validation dataset for data leakage by checking that test features are not visible during training. NULL [SELECT * FROM ts_check_leakage('cv_splits', product_id, date, fold_id, split)]
anofox_fcst_ts_classify_seasonality scalar Classifies the seasonality type (timing and modulation) of a time series, returning timing_classification, modulation_type, and seasonal strength. NULL [ts_classify_seasonality(LIST(value ORDER BY date), 7)]
anofox_fcst_ts_classify_seasonality table_macro Single-series seasonality classification. Classifies seasonality type and returns timing metadata. NULL [SELECT * FROM ts_classify_seasonality('sales', product_id, date, qty)]
anofox_fcst_ts_classify_seasonality_agg aggregate Aggregate function: classifies the seasonality type (none, additive, multiplicative) for each group. NULL [SELECT product_id, anofox_fcst_ts_classify_seasonality_agg(date, value, MAP{}) FROM sales GROUP BY product_id]
anofox_fcst_ts_classify_seasonality_by table_macro Classifies seasonality type (additive/multiplicative/none) for each group. NULL [SELECT * FROM ts_classify_seasonality_by('sales', product_id, date, qty)]
anofox_fcst_ts_conformal_apply scalar Applies a pre-calibrated conformal quantile to new point forecasts to produce prediction intervals. NULL [ts_conformal_apply(point_forecast, conformal_q)]
anofox_fcst_ts_conformal_apply_by table_macro Applies a calibration table (from ts_conformal_calibrate) to new point forecasts, matching each group to its own row or a pooled row. NULL [SELECT * FROM ts_conformal_apply_by('forecasts', product_id, date, point_forecast, 'calibration_profile')]
anofox_fcst_ts_conformal_by table_macro One-step conformal prediction: calibrates on backtest residuals and applies to new forecasts, one row per (group, date). NULL [SELECT * FROM ts_conformal_by('backtest', product_id, date, actual, forecast, point_forecast)]
anofox_fcst_ts_conformal_calibrate table_macro Calibrates a conformal predictor per group (or pooled on request) and returns the calibration profile for reuse. NULL [SELECT * FROM ts_conformal_calibrate('backtest', product_id, actual, forecast)]
anofox_fcst_ts_conformal_coverage scalar Computes empirical coverage rate of conformal prediction intervals on a test set. NULL [ts_conformal_coverage(actual, lower, upper)]
anofox_fcst_ts_conformal_evaluate scalar Evaluates conformal interval quality returning coverage, mean width, and efficiency metrics. NULL [ts_conformal_evaluate(actual, lower, upper, 0.1)]
anofox_fcst_ts_conformal_intervals scalar Computes symmetric conformal prediction intervals by applying a conformal quantile to point forecasts. NULL [ts_conformal_intervals(point_forecast, conformal_q)]
anofox_fcst_ts_conformal_learn scalar Learns a conformal calibration profile from residuals. Strategies: 'split', 'crossval' (alias cross_val, cv) – 'jackknife+' was removed in Phase 16 (it computed the same quantile as 'split'). NULL [ts_conformal_learn(residuals, [0.1], 'symmetric', 'split')]
anofox_fcst_ts_conformal_predict scalar End-to-end symmetric conformal prediction: calibrates on residuals and applies to forecasts in one step. NULL [ts_conformal_predict(calibration_actuals, calibration_forecasts, point_forecast, 0.1)]
anofox_fcst_ts_conformal_predict_asymmetric scalar End-to-end asymmetric conformal prediction using separate upper and lower quantiles for skewed errors. NULL [ts_conformal_predict_asymmetric(calibration_actuals, calibration_forecasts, point_forecast, 0.1)]
anofox_fcst_ts_conformal_predict_per_step scalar Per-step conformal prediction that calibrates separate intervals for each forecast horizon step. NULL [ts_conformal_predict_per_step(calibration_actuals, calibration_forecasts, point_forecast, 0.1)]
anofox_fcst_ts_conformal_quantile scalar Computes the conformal quantile from calibration nonconformity scores at a given miscoverage rate alpha. NULL [ts_conformal_quantile(calibration_scores, 0.1)]
anofox_fcst_ts_coverage scalar Computes the empirical coverage rate of prediction intervals: fraction of actuals within [lower, upper]. NULL [ts_coverage(LIST(actual ORDER BY date), LIST(lower ORDER BY date), LIST(upper ORDER BY date))]
anofox_fcst_ts_coverage_by table_macro Computes prediction interval coverage rate per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/lower_col/upper_col are quoted column-name string literals. NULL [SELECT * FROM ts_coverage_by((SELECT product_id, date, actual, lower, upper FROM results), 'date', 'actual', 'lower', 'upper')]
anofox_fcst_ts_cv_folds_by table_macro Generates cross-validation fold definitions (cutoff dates) without splitting the data. NULL [SELECT * FROM ts_cv_folds_by('sales', product_id, date, qty, 3, 12, '1d')]
anofox_fcst_ts_cv_forecast_by table_macro Runs forecasts on all cross-validation folds and returns predictions with fold metadata. NULL [SELECT * FROM ts_cv_forecast_by('cv_splits', product_id, date, qty, 'AutoETS')]
anofox_fcst_ts_cv_hydrate_by table_macro Joins external features to CV splits with proper masking to prevent data leakage. NULL [SELECT * FROM ts_cv_hydrate_by('cv_splits', product_id, date, qty, 'features', unknown_cols)]
anofox_fcst_ts_cv_split_by table_macro Creates cross-validation train/test splits from explicit fold boundary dates. NULL [SELECT * FROM ts_cv_split_by('sales', product_id, date, qty, 'folds', fold_id, cutoff)]
anofox_fcst_ts_cv_split_folds_by table_macro Splits time series into cross-validation folds with configurable gap, embargo, and window parameters. NULL [SELECT * FROM ts_cv_split_folds_by('sales', product_id, date, qty, 3, 12, '1d')]
anofox_fcst_ts_cv_split_index_by table_macro Memory-efficient cross-validation split using row indices instead of full data copies. NULL [SELECT * FROM ts_cv_split_index_by('sales', product_id, date, qty, 3, 12, '1d')]
anofox_fcst_ts_data_quality table_macro Assesses time series data quality per group (dates/frequency-aware gap and temporal scoring; n_short drives is_short), returning null rate, gap rate (n_gaps = missing periods, n_gap_runs = gap occurrences), duplicate count, and quality score. NULL [SELECT * FROM ts_data_quality('sales', product_id, date, qty, 10, '1d')]
anofox_fcst_ts_data_quality_agg aggregate Aggregate function: assesses time series data quality for each group (dates/frequency-aware; n_short=30), reporting null counts, gap counts (n_gaps = missing periods, n_gap_runs = gap occurrences), duplicates, is_short, and quality score. NULL [SELECT product_id, anofox_fcst_ts_data_quality_agg(date, value) FROM sales GROUP BY product_id]
anofox_fcst_ts_data_quality_by table_macro Alias for ts_data_quality. Assesses time series data quality per group (dates/frequency-aware). NULL [SELECT * FROM ts_data_quality_by('sales', product_id, date, qty, 10, '1d')]
anofox_fcst_ts_data_quality_summary table_macro Summarizes ts_data_quality output across all groups into aggregate quality metrics (auto-detected frequency per series). n_unassessed counts groups whose quality struct is NULL (e.g. all dates NULL after filtering), so that n_good + n_fair + n_poor + n_unassessed = n_total; avg_score is the mean overall_score over assessed groups only. NULL [SELECT * FROM ts_data_quality_summary('sales', product_id, date, qty, 10)]
anofox_fcst_ts_detect_changepoints table_macro Detects structural changepoints in a single time series using Bayesian Online Changepoint Detection. NULL [SELECT * FROM ts_detect_changepoints('sales', product_id, date, qty)]
anofox_fcst_ts_detect_changepoints_agg aggregate Aggregate function: detects structural changepoints in time series for each group using Bayesian Online Changepoint Detection (BOCPD). NULL [SELECT product_id, anofox_fcst_ts_detect_changepoints_agg(date, value, MAP{}) FROM sales GROUP BY product_id]
anofox_fcst_ts_detect_changepoints_by table_macro Detects structural changepoints for each group using Bayesian Online Changepoint Detection. NULL [SELECT * FROM ts_detect_changepoints_by('sales', product_id, date, qty)]
anofox_fcst_ts_detect_peaks table_macro Detects peaks in a single time series, returning peak indices, values, and prominence scores. NULL [SELECT * FROM ts_detect_peaks('sales', product_id, date, qty)]
anofox_fcst_ts_detect_peaks_by table_macro Detects peaks in each group's time series, returning peak indices, values, and prominence scores. NULL [SELECT * FROM ts_detect_peaks_by('sales', product_id, date, qty)]
anofox_fcst_ts_detect_periods table_macro Detects seasonal periods for a single time series, returning ranked period candidates with confidence scores. NULL [SELECT * FROM ts_detect_periods('sales', product_id, date, qty)]
anofox_fcst_ts_detect_periods_agg aggregate Aggregate function: detects seasonal periods for each group, returning the primary period, confidence, and a ranked list of candidates. NULL [SELECT product_id, anofox_fcst_ts_detect_periods_agg(date, value) FROM sales GROUP BY product_id]
anofox_fcst_ts_detect_periods_agg aggregate Aggregate function: detects seasonal periods for each group, returning the primary period, confidence, and a ranked list of candidates. NULL [SELECT product_id, anofox_fcst_ts_detect_periods_agg(date, value, MAP{'method': 'auto'}) FROM sales GROUP BY product_id]
anofox_fcst_ts_detect_periods_by table_macro Detects seasonal periods for each group, returning ranked period candidates with confidence scores. NULL [SELECT * FROM ts_detect_periods_by('sales', product_id, date, qty)]
anofox_fcst_ts_detect_seasonality scalar Tests whether a time series exhibits statistically significant seasonality. Returns TRUE/FALSE or a confidence score. NULL [ts_detect_seasonality(LIST(value ORDER BY date))]
anofox_fcst_ts_detrend_by table_macro Removes the trend component from each group's time series. NULL [SELECT * FROM ts_detrend_by('sales', product_id, date, qty, 'cubic')]
anofox_fcst_ts_diff_by table_macro Computes d-th order differences for each group's time series in Rust (numpy diff(n=diff_order)): value[t] - value[t-1] applied diff_order times. seasonal_lag (default 1) sets the lag-k difference step for the old lag-based semantics (R diff(x, lag=seasonal_lag, differences=diff_order)). One row per input row; the first diff_order*seasonal_lag rows per group are NULL. Any difference touching a NULL input is NULL (never an error). NULL [SELECT * FROM ts_diff_by('sales', product_id, date, qty, 2) – or: …, 1, seasonal_lag := 2)]
anofox_fcst_ts_drop_constant_by table_macro Removes groups whose time series classify as constant under the Rust is_constant tolerance (scale-relative: max - min <= 1e-10 * max(1, max|x|) over non-NULL/non-NaN values, D-13): fewer than two present values (including an all-NULL group), or all present values within that scale-relative tolerance of each other. NULL [SELECT * FROM ts_drop_constant_by('sales', product_id, date, qty)]
anofox_fcst_ts_drop_edge_zeros_by table_macro Removes both leading and trailing zeros from each group's time series. NULL [SELECT * FROM ts_drop_edge_zeros_by('sales', product_id, date, qty)]
anofox_fcst_ts_drop_gappy_by table_macro Removes groups whose time series have a gap rate exceeding a threshold. NULL [SELECT * FROM ts_drop_gappy_by('sales', product_id, date, qty, '1d', 0.1)]
anofox_fcst_ts_drop_leading_zeros_by table_macro Removes leading zeros from each group's time series, trimming the start of the series. NULL [SELECT * FROM ts_drop_leading_zeros_by('sales', product_id, date, qty)]
anofox_fcst_ts_drop_short_by table_macro Removes groups with fewer observations than the specified minimum length. NULL [SELECT * FROM ts_drop_short_by('sales', product_id, date, qty, 20)]
anofox_fcst_ts_drop_trailing_zeros_by table_macro Removes trailing zeros from each group's time series, trimming the end of the series. NULL [SELECT * FROM ts_drop_trailing_zeros_by('sales', product_id, date, qty)]
anofox_fcst_ts_drop_zeros_by table_macro Removes groups whose time series are predominantly zero values. NULL [SELECT * FROM ts_drop_zeros_by('sales', product_id, date, qty, 0.8)]
anofox_fcst_ts_durbin_watson scalar Durbin-Watson first-order autocorrelation statistic on residuals. Returns STRUCT(statistic DOUBLE, interpretation VARCHAR); statistic in [0,4], ~2 means no autocorrelation. interpretation is one of positive_strong / positive_weak / none / negative_weak / negative_strong. (prefixed alias). NULL  
anofox_fcst_ts_durbin_watson_by table_macro Durbin-Watson first-order autocorrelation statistic on residuals per group. Returns STRUCT(statistic, interpretation); statistic in [0,4], ~2 means no autocorrelation. NULL [SELECT group_col, (durbin_watson).statistic FROM ts_durbin_watson_by('resids', product_id, ds, e)]
anofox_fcst_ts_ensemble_inspect_by table_macro Returns per-member combination weights for an explicit-member ensemble. One row per (group, member). weight sums to 1.0 per group for all six combination methods. score column is NULL (use ts_auto_ensemble_inspect_by for AutoEnsemble in-sample MSE scores). combination_method: 'mean' (default), 'median', 'weighted_mse', 'inverse_aic', 'stacking', 'horizon_adaptive'. HorizonAdaptive returns the AVERAGE per-horizon weight (per-step matrix out of scope for INSP-01 v1). NULL [SELECT * FROM ts_ensemble_inspect_by('sales', id, ds, y, ['AutoARIMA','AutoETS','Naive'], combination_method := 'weighted_mse')]
anofox_fcst_ts_features_agg aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, anofox_fcst_ts_features_agg(date, value) FROM sales GROUP BY product_id]
anofox_fcst_ts_features_agg aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, anofox_fcst_ts_features_agg(date, value, ['mean'], NULL) FROM sales GROUP BY product_id]
anofox_fcst_ts_features_agg aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, anofox_fcst_ts_features_agg(date, value, config) FROM sales GROUP BY product_id]
anofox_fcst_ts_features_by table_macro Extracts time series features for each group and returns results as a structured table. NULL [SELECT * FROM ts_features_by('sales', product_id, date, qty)]
anofox_fcst_ts_features_config_from_csv scalar Parses a CSV string of feature names into a feature configuration for use with ts_features_by(). NULL [ts_features_config_from_csv('mean,std,skewness')]
anofox_fcst_ts_features_config_from_json scalar Parses a feature configuration JSON string for use with ts_features_by() to select specific features. NULL [ts_features_config_from_json('{"features": ["mean", "std"]}')]
anofox_fcst_ts_features_table table_macro Extracts 117 tsfresh-compatible features and returns them as a wide table (one column per feature). NULL [SELECT * FROM ts_features_table('sales', product_id, date, qty)]
anofox_fcst_ts_fill_forward_by table_macro Forward-fills missing timestamps in each group's time series using the last known value. NULL [SELECT * FROM ts_fill_forward_by('sales', product_id, date, qty, '1d')]
anofox_fcst_ts_fill_forward_operator table Native table function: forward-fills NULL values in time series within groups. Used internally by ts_fill_forward_by(). NULL [SELECT * FROM anofox_fcst_ts_fill_forward_operator(source_table, group_col, date_col, value_col, target_date, frequency)]
anofox_fcst_ts_fill_gaps_by table_macro Fills missing timestamps in each group's time series to create a regular frequency grid. NULL [SELECT * FROM ts_fill_gaps_by('sales', product_id, date, qty, '1d')]
anofox_fcst_ts_fill_nulls_backward_by table_macro Backward-fills NULL values in each group's time series using the next known value. NULL [SELECT * FROM ts_fill_nulls_backward_by('sales', product_id, date, qty)]
anofox_fcst_ts_fill_nulls_const_by table_macro Fills NULL values in each group's time series with a constant value. NULL [SELECT * FROM ts_fill_nulls_const_by('sales', product_id, date, qty, 0.0)]
anofox_fcst_ts_fill_nulls_forward_by table_macro Forward-fills NULL values in each group's time series using the last known value. NULL [SELECT * FROM ts_fill_nulls_forward_by('sales', product_id, date, qty)]
anofox_fcst_ts_fill_nulls_mean_by table_macro Fills NULL values in each group's time series with the group mean, computed in Rust (fill_nulls_mean): NaN counts as missing; an all-NULL/all-NaN group keeps every value NULL. All input columns are preserved. NULL [SELECT * FROM ts_fill_nulls_mean_by('sales', product_id, date, qty)]
anofox_fcst_ts_fill_unknown_by table_macro Fills unknown (NULL) feature values using a specified strategy for cross-validation. NULL [SELECT * FROM ts_fill_unknown_by('cv_data', product_id, date, feature_col, 'last_value')]
anofox_fcst_ts_forecast table_macro Generates a forecast for a single time series. Returns point forecasts with prediction intervals. NULL [SELECT * FROM ts_forecast('sales', product_id, date, qty, 'AutoETS', 12, '1d')]
anofox_fcst_ts_forecast_agg aggregate Aggregate function: produces a time series forecast for each group. Supports 32 forecasting models. Returns STRUCT(point[], lower[], upper[], fitted[], residuals[], model, aic, bic, mse). NULL [SELECT product_id, anofox_fcst_ts_forecast_agg(date, value, 'AutoETS', 12, MAP{}) FROM sales GROUP BY product_id]
anofox_fcst_ts_forecast_by table_macro Generates forecasts for multiple time series grouped by one or more keys. Returns point forecasts with prediction intervals. NULL [SELECT * FROM ts_forecast_by('sales', product_id, date, qty, 'AutoETS', 12, '1d')]
anofox_fcst_ts_forecast_ensemble_by table_macro Generates ensemble forecasts from explicitly named member models per series. members is a VARCHAR[] list (e.g. ['AutoARIMA','AutoETS','Naive']). combination_method: 'mean' (default), 'median', 'weighted_mse', 'inverse_aic', 'stacking', 'horizon_adaptive'. yhat_lower / yhat_upper are the crate Ensemble's own prediction interval at confidence_level (default 0.90). NULL [SELECT * FROM ts_forecast_ensemble_by('sales', product_id, date, qty, ['AutoARIMA','AutoETS','Naive'], 12, '1d')]
anofox_fcst_ts_forecast_exog table_macro Generates a forecast for a single time series using exogenous regressors. NULL [SELECT * FROM ts_forecast_exog('sales', product_id, date, qty, 'future_features', 'AutoARIMA', 12, '1d')]
anofox_fcst_ts_forecast_exog_by table_macro Generates forecasts for multiple time series using exogenous regressors. NULL [SELECT * FROM ts_forecast_exog_by('sales', product_id, date, qty, 'future_features', 'AutoARIMA', 12, '1d')]
anofox_fcst_ts_forecast_explain_by table_macro Returns per-horizon forecast decomposition (level, trend, seasonal, residual) per group as a wide STRUCT. Supports ETS, MSTL, Theta. NULL [SELECT group_col, (decomposition).trend, (decomposition).seasonal FROM ts_forecast_explain_by('sales', product_id, ds, y, 'ETS', 12, {seasonal_period: 12})]
anofox_fcst_ts_forecast_inspect_by table_macro Returns per-group Inspectable fit-state snapshot (coefficients, AIC/BIC, components, residuals) as a wide STRUCT. NULL [SELECT group_col, (inspection).spec, (inspection).aic FROM ts_forecast_inspect_by('sales', product_id, ds, y, 'AutoETS')]
anofox_fcst_ts_forecast_panel_by table_macro Forecasts a grouped panel using cross-series global learners (GlobalETS, GlobalTheta, GlobalCroston). All series are fitted simultaneously with shared parameters (fit-once-emit-many). Ragged panels are auto-aligned to a shared date grid before the global fit. Returns one row per (group, horizon step). Series with fewer than 10 valid observations are surfaced with model_name = 'DROPPED: too_short'. NULL [SELECT * FROM ts_forecast_panel_by('sales', product_id, date, qty, 'GlobalETS', 14, '1d', MAP{'seasonal_period': '7'})]
anofox_fcst_ts_forecast_var_by table_macro VAR multivariate forecasting. Fits a single VAR(p) model across all K value columns and returns one row per (variable, horizon step) in long format (LONG output shape). value_cols is a VARCHAR[] of column names from source (e.g. ['y1','y2']). date_col is the name of the date column (VARCHAR string, e.g. 'ds'). p is the VAR lag order (default 1). forecast_value is a point forecast (no prediction intervals in v1). v1 is single-panel only (no group_col — one VAR fit for the entire input table). NULL [SELECT * FROM ts_forecast_var_by('returns', 'ds', ['equity','bond','fx'], 12, '1d', p:=2)]
anofox_fcst_ts_interval_width_by table_macro Computes the mean width of prediction intervals for each group, pairing lower/upper by date_col. NULL [SELECT * FROM ts_interval_width_by('forecasts', product_id, date, lower, upper)]
anofox_fcst_ts_jarque_bera scalar Jarque-Bera normality test on residuals. Returns STRUCT(statistic DOUBLE, p_value DOUBLE, skewness DOUBLE, excess_kurtosis DOUBLE). A small p-value rejects normality. (prefixed alias). NULL  
anofox_fcst_ts_jarque_bera_by table_macro Jarque-Bera normality test on residuals per group. Returns STRUCT(statistic, p_value, skewness, excess_kurtosis). A small p-value rejects normality. NULL [SELECT group_col, (jarque_bera).p_value FROM ts_jarque_bera_by('resids', product_id, ds, e)]
anofox_fcst_ts_kpss scalar KPSS stationarity test (prefixed alias). NULL [anofox_fcst_ts_kpss(LIST(y ORDER BY ds))]
anofox_fcst_ts_kpss_by table_macro KPSS stationarity test per group. Returns STRUCT(statistic, p_value, lags, is_stationary, cv_1pct, cv_5pct, cv_10pct) per group. Pass lags:=N to override the automatic bandwidth. regression:='c' (level, null hypothesis is level-stationarity, default) or regression:='ct' (trend). is_stationary=true means the null is not rejected at 5%. NULL [SELECT group_col, (kpss).statistic, (kpss).is_stationary FROM ts_kpss_by('sales', product_id, ds, y, regression := 'ct')]
anofox_fcst_ts_ljung_box scalar Ljung-Box white-noise test on residuals (prefixed alias). NULL  
anofox_fcst_ts_ljung_box_by table_macro Ljung-Box white-noise test on residuals per group. Returns STRUCT(statistic, p_value, lags, df). value_col should be model residuals; default lags = min(10, n/5). Pass lags:=N to override. df = lags - fitted_params; pass fitted_params := p + q for ARMA(p, q) residuals to get R Box.test(fitdf = p + q)-matching p-values (fitted_params >= the effective lags is a SQL error). NULL [SELECT group_col, (ljung_box).p_value FROM ts_ljung_box_by('resids', product_id, ds, e, fitted_params := 2)]
anofox_fcst_ts_mae scalar Computes Mean Absolute Error (MAE) between actual and predicted value arrays. NULL [ts_mae(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
anofox_fcst_ts_mae_by table_macro Computes Mean Absolute Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mae_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
anofox_fcst_ts_mape scalar Computes Mean Absolute Percentage Error (MAPE) between actual and predicted value arrays. Returns NULL if any actual value is exactly zero (MAPE is undefined there); use ts_smape or ts_mase for intermittent-demand series. NULL [ts_mape(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
anofox_fcst_ts_mape_by table_macro Computes Mean Absolute Percentage Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mape_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
anofox_fcst_ts_mark_unknown_by table_macro Marks future values as unknown (NULL) for cross-validation leakage prevention. NULL [SELECT * FROM ts_mark_unknown_by('features', product_id, date, feature_col, cutoff_date)]
anofox_fcst_ts_mase scalar Computes Hyndman-Koehler Mean Absolute Scaled Error (MASE): the out-of-sample forecast MAE scaled by the in-sample seasonal-naive MAE at lag seasonal_period. The old 3-argument (actual, forecast, baseline) form was removed in v2026.10.16 (it computed a relative MAE, not MASE) – use ts_rmae for that. NULL [ts_mase(LIST(actual ORDER BY date), LIST(forecast ORDER BY date), LIST(insample ORDER BY date), 12)]
anofox_fcst_ts_mase_by table_macro Computes Hyndman-Koehler Mean Absolute Scaled Error (MASE) per group: the out-of-sample forecast MAE scaled by the in-sample seasonal-naive MAE at lag seasonal_period (default 1). Source rows dated before each group's first forecast (forecast NULL) supply the in-sample scale. The old baseline-column form was removed in v2026.10.16 – use ts_rmae_by for a relative-MAE comparison. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mase_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast', seasonal_period := 4)]
anofox_fcst_ts_mean_interval_width scalar Computes the mean width of prediction intervals: average of (upper - lower) across all steps. NULL [ts_mean_interval_width(lower, upper)]
anofox_fcst_ts_mqloss scalar Computes Mean Quantile Loss (MQLoss) across multiple quantile levels. NULL [ts_mqloss(LIST(actual ORDER BY date), LIST([lower, upper] ORDER BY date), [0.1, 0.9])]
anofox_fcst_ts_mse scalar Computes Mean Squared Error (MSE) between actual and predicted value arrays. NULL [ts_mse(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
anofox_fcst_ts_mse_by table_macro Computes Mean Squared Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mse_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
anofox_fcst_ts_mstl_decomposition_by table_macro Decomposes each group's time series into trend, seasonal, and remainder components using MSTL. params: seasonal_periods (alias periods) is a list of seasonal periods to extract, e.g. '[7, 365]' or [7, 365]; insufficient_data is 'fail' (default), 'trend', or 'none'. NULL [SELECT * FROM ts_mstl_decomposition_by('sales', product_id, date, qty, MAP{'seasonal_periods': '[7, 365]'})]
anofox_fcst_ts_quality_report table_macro Generates a data quality report with null counts, gap counts, duplicate timestamps, and quality score per group. NULL [SELECT * FROM ts_quality_report('sales', product_id, date, qty)]
anofox_fcst_ts_quantile_loss scalar Computes the quantile (pinball) loss for a single quantile level. NULL [ts_quantile_loss(LIST(actual ORDER BY date), LIST(forecast ORDER BY date), 0.9)]
anofox_fcst_ts_quantile_loss_by table_macro Computes quantile (pinball) loss at a specified quantile level per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_quantile_loss_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast', 0.9)]
anofox_fcst_ts_r2 scalar Computes the R-squared (coefficient of determination) between actual and predicted value arrays. NULL [ts_r2(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
anofox_fcst_ts_r2_by table_macro Computes R-squared (coefficient of determination) between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_r2_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
anofox_fcst_ts_residual_diagnostics scalar Combined residual adequacy report (prefixed alias). NULL  
anofox_fcst_ts_residual_diagnostics_by table_macro Combined residual adequacy report per group: Ljung-Box + Durbin-Watson + Jarque-Bera. Returns STRUCT(lb_statistic, lb_p_value, lb_lags, dw_statistic, dw_interpretation, jb_statistic, jb_p_value, jb_skewness, jb_excess_kurtosis, adequate). adequate = (lb_p_value > alpha), alpha default 0.05. NULL [SELECT group_col, (residual_diagnostics).adequate FROM ts_residual_diagnostics_by('resids', product_id, ds, e)]
anofox_fcst_ts_rmae scalar Computes Relative MAE: ratio of MAE(actual, pred1) to MAE(actual, pred2). Values < 1 mean pred1 is better. NULL [ts_rmae(LIST(actual ORDER BY date), LIST(model_a ORDER BY date), LIST(model_b ORDER BY date))]
anofox_fcst_ts_rmae_by table_macro Computes Relative MAE (MAE ratio between two models) per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/pred1_col/pred2_col are quoted column-name string literals. NULL [SELECT * FROM ts_rmae_by((SELECT product_id, date, actual, pred1, pred2 FROM results), 'date', 'actual', 'pred1', 'pred2')]
anofox_fcst_ts_rmse scalar Computes Root Mean Squared Error (RMSE) between actual and predicted value arrays. NULL [ts_rmse(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
anofox_fcst_ts_rmse_by table_macro Computes Root Mean Squared Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_rmse_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
anofox_fcst_ts_smape scalar Computes Symmetric Mean Absolute Percentage Error (sMAPE) between actual and predicted value arrays. NULL [ts_smape(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
anofox_fcst_ts_smape_by table_macro Computes Symmetric Mean Absolute Percentage Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_smape_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
anofox_fcst_ts_stationarity scalar Combined ADF + KPSS stationarity verdict (prefixed alias). NULL [anofox_fcst_ts_stationarity(LIST(y ORDER BY ds))]
anofox_fcst_ts_stationarity_by table_macro Combined ADF + KPSS stationarity verdict per group (D-04). Returns STRUCT(adf_statistic, adf_p_value, kpss_statistic, kpss_p_value, adf_is_stationary, kpss_is_stationary, verdict) per group. verdict is one of 'stationary', 'non_stationary', 'trend_stationary', 'difference_stationary', 'constant', or NULL (degenerate series). regression:='c' (default, applies to both tests) or regression:='ct'. NULL [SELECT group_col, (stationarity).verdict FROM ts_stationarity_by('sales', product_id, ds, y, regression := 'ct')]
anofox_fcst_ts_stats table_macro Computes 36 time series statistics per group (including n_gap_runs). trend_strength/seasonality_strength are STL-based (D-02); seasonal_period (default 0) selects 0=auto-detect, 1=non-seasonal, >=2=explicit period. Returns a wide table with one column per statistic. NULL [SELECT * FROM ts_stats('sales', product_id, date, qty, '1d', seasonal_period := 12)]
anofox_fcst_ts_stats_agg aggregate Aggregate function: computes 36 time series statistics for each group (including n_gap_runs). Returns a STRUCT with mean, std, min, max, trend, seasonality, and many more. NULL [SELECT product_id, anofox_fcst_ts_stats_agg(date, value) FROM sales GROUP BY product_id]
anofox_fcst_ts_stats_by table_macro Alias for ts_stats. Computes 36 time series statistics per group (including n_gap_runs). seasonal_period (default 0) selects 0=auto-detect, 1=non-seasonal, >=2=explicit period for the STL-based trend_strength/seasonality_strength. NULL [SELECT * FROM ts_stats_by('sales', product_id, date, qty, '1d', seasonal_period := 12)]
anofox_fcst_ts_stats_summary table_macro Aggregates ts_stats output across all groups into summary statistics (mean, std, min, max per metric). NULL [SELECT * FROM ts_stats_summary('sales', product_id, date, qty, '1d')]
anofox_fcst_ts_validate_timestamps_by table_macro Validates that timestamps are unique, monotonically increasing, and match the expected frequency per group. NULL [SELECT * FROM ts_validate_timestamps_by('sales', product_id, date, qty, '1d')]
anofox_fcst_ts_validate_timestamps_summary_by table_macro Summarizes ts_validate_timestamps_by results across all groups. NULL [SELECT * FROM ts_validate_timestamps_summary_by('sales', product_id, date, qty, '1d')]
ts_adf scalar Augmented Dickey-Fuller (ADF) unit-root test, matching statsmodels adfuller(autolag='AIC'). Returns STRUCT(statistic DOUBLE, p_value DOUBLE, lags BIGINT, is_stationary BOOLEAN, cv_1pct DOUBLE, cv_5pct DOUBLE, cv_10pct DOUBLE). AIC lag selection over 0..max_lags; default max_lags = floor((n-1)^(1/3)). regression is 'c' (constant, default) or 'ct' (constant + trend); NULL means 'c'. p-values are MacKinnon (1994) and critical values are MacKinnon (2010) finite-sample surfaces. Returns NaN statistic/p_value/critical values for series shorter than 4 observations or an exactly-collinear regression. NULL [ts_adf(LIST(y ORDER BY ds)), ts_adf(LIST(y ORDER BY ds), 3), ts_adf(LIST(y ORDER BY ds), -1, 'ct')]
ts_adf_by table_macro ADF stationarity test per group. Returns STRUCT(statistic, p_value, lags, is_stationary, cv_1pct, cv_5pct, cv_10pct) per group. AIC lag selection; pass max_lags:=N to override automatic lag selection. regression:='c' (constant, default) or regression:='ct' (constant + trend). NULL [SELECT group_col, (adf).statistic, (adf).p_value FROM ts_adf_by('sales', product_id, ds, y, regression := 'ct')]
ts_aggregate_hierarchy table Aggregates time series data up through a hierarchy of group keys, rolling up lower-level series to higher levels. NULL [SELECT * FROM ts_aggregate_hierarchy(TABLE(SELECT date, value, region, store, item FROM t), MAP {'separator': '|'})]
ts_aic_period scalar Estimates the seasonal period by minimizing the Akaike Information Criterion (AIC) over candidate periods. NULL [ts_aic_period(LIST(value ORDER BY date))]
ts_analyze_peak_timing scalar Analyzes timing patterns of peaks detected by ts_detect_peaks, returning periodicity and phase statistics. NULL [ts_analyze_peak_timing(LIST(value ORDER BY date), LIST(date ORDER BY date))]
ts_analyze_peak_timing table_macro Analyzes peak timing variability for a single time series. NULL [SELECT * FROM ts_analyze_peak_timing('sales', product_id, date, qty, 7)]
ts_analyze_peak_timing_by table_macro Analyzes peak timing variability for each group, returning timing statistics and stability score. NULL [SELECT * FROM ts_analyze_peak_timing_by('sales', product_id, date, qty, 7)]
ts_analyze_seasonality scalar Analyzes seasonal patterns in detail, returning amplitude, phase, strength, and period information. NULL [ts_analyze_seasonality(LIST(ts ORDER BY ts), LIST(value ORDER BY ts))]
ts_analyze_seasonality scalar Analyzes seasonal patterns in detail, returning amplitude, phase, strength, and period information. NULL [ts_analyze_seasonality(LIST(value ORDER BY date), 7)]
ts_auto_ensemble_inspect_by table_macro Returns selected member names and in-sample MSE scores for an AutoEnsemble per series. weight = 1/k for Mean combination; NULL for all other methods (crate 0.15.3 limitation — inner AutoEnsemble combination weights are not accessible via public API). rank = 1..k by ascending MSE (best = 1). score = in-sample MSE from AutoEnsemble.all_scores(). NULL [SELECT * FROM ts_auto_ensemble_inspect_by('sales', id, ds, y, top_k := 3, combination_method := 'mean')]
ts_autoperiod scalar Estimates the seasonal period using the Autoperiod algorithm combining FFT and autocorrelation. NULL [ts_autoperiod(LIST(value ORDER BY date))]
ts_bias scalar Computes mean forecast bias (mean error) between actual and predicted value arrays. NULL [ts_bias(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
ts_bias_by table_macro Computes mean forecast bias between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_bias_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
ts_bootstrap_intervals scalar Generates bootstrap prediction intervals by resampling historical residuals. Returns STRUCT(point[], lower[], upper[], coverage). NULL [ts_bootstrap_intervals(residuals, point_forecast, 1000, 0.90, 42)]
ts_bootstrap_quantiles scalar Generates bootstrap quantile intervals by resampling historical residuals. Returns STRUCT(point[], quantiles[], values[][]). NULL [ts_bootstrap_quantiles(residuals, point_forecast, 1000, [0.1, 0.5, 0.9], 42)]
ts_cfd_autoperiod scalar Estimates the seasonal period using Conditional Frequency Distribution (CFD) autoperiod method. NULL [ts_cfd_autoperiod(LIST(value ORDER BY date))]
ts_check_leakage table_macro Audits a cross-validation dataset for data leakage by checking that test features are not visible during training. NULL [SELECT * FROM ts_check_leakage('cv_splits', product_id, date, fold_id, split)]
ts_classify_seasonality scalar Classifies the seasonality type (timing and modulation) of a time series, returning timing_classification, modulation_type, and seasonal strength. NULL [ts_classify_seasonality(LIST(value ORDER BY date), 7)]
ts_classify_seasonality table_macro Single-series seasonality classification. Classifies seasonality type and returns timing metadata. NULL [SELECT * FROM ts_classify_seasonality('sales', product_id, date, qty)]
ts_classify_seasonality_agg aggregate Aggregate function: classifies the seasonality type (none, additive, multiplicative) for each group. NULL [SELECT product_id, ts_classify_seasonality_agg(date, value, MAP{}) FROM sales GROUP BY product_id]
ts_classify_seasonality_by table_macro Classifies seasonality type (additive/multiplicative/none) for each group. NULL [SELECT * FROM ts_classify_seasonality_by('sales', product_id, date, qty)]
ts_combine_keys table Combines multiple group key columns into a single composite key column for multi-key time series operations. NULL [SELECT * FROM ts_combine_keys(TABLE(SELECT date, value, region, store FROM t), MAP {'separator': '|'})]
ts_conformal_apply scalar Applies a pre-calibrated conformal quantile to new point forecasts to produce prediction intervals. NULL [ts_conformal_apply(point_forecast, conformal_q)]
ts_conformal_apply_by table_macro Applies a calibration table (from ts_conformal_calibrate) to new point forecasts, matching each group to its own row or a pooled row. NULL [SELECT * FROM ts_conformal_apply_by('forecasts', product_id, date, point_forecast, 'calibration_profile')]
ts_conformal_by table_macro One-step conformal prediction: calibrates on backtest residuals and applies to new forecasts, one row per (group, date). NULL [SELECT * FROM ts_conformal_by('backtest', product_id, date, actual, forecast, point_forecast)]
ts_conformal_calibrate table_macro Calibrates a conformal predictor per group (or pooled on request) and returns the calibration profile for reuse. NULL [SELECT * FROM ts_conformal_calibrate('backtest', product_id, actual, forecast)]
ts_conformal_coverage scalar Computes empirical coverage rate of conformal prediction intervals on a test set. NULL [ts_conformal_coverage(actual, lower, upper)]
ts_conformal_evaluate scalar Evaluates conformal interval quality returning coverage, mean width, and efficiency metrics. NULL [ts_conformal_evaluate(actual, lower, upper, 0.1)]
ts_conformal_intervals scalar Computes symmetric conformal prediction intervals by applying a conformal quantile to point forecasts. NULL [ts_conformal_intervals(point_forecast, conformal_q)]
ts_conformal_learn scalar Learns a conformal calibration profile from residuals. Strategies: 'split', 'crossval' (alias cross_val, cv) – 'jackknife+' was removed in Phase 16 (it computed the same quantile as 'split'). NULL [ts_conformal_learn(residuals, [0.1], 'symmetric', 'split')]
ts_conformal_predict scalar End-to-end symmetric conformal prediction: calibrates on residuals and applies to forecasts in one step. NULL [ts_conformal_predict(calibration_actuals, calibration_forecasts, point_forecast, 0.1)]
ts_conformal_predict_asymmetric scalar End-to-end asymmetric conformal prediction using separate upper and lower quantiles for skewed errors. NULL [ts_conformal_predict_asymmetric(calibration_actuals, calibration_forecasts, point_forecast, 0.1)]
ts_conformal_predict_per_step scalar Per-step conformal prediction that calibrates separate intervals for each forecast horizon step. NULL [ts_conformal_predict_per_step(calibration_actuals, calibration_forecasts, point_forecast, 0.1)]
ts_conformal_quantile scalar Computes the conformal quantile from calibration nonconformity scores at a given miscoverage rate alpha. NULL [ts_conformal_quantile(calibration_scores, 0.1)]
ts_coverage scalar Computes the empirical coverage rate of prediction intervals: fraction of actuals within [lower, upper]. NULL [ts_coverage(LIST(actual ORDER BY date), LIST(lower ORDER BY date), LIST(upper ORDER BY date))]
ts_coverage_by table_macro Computes prediction interval coverage rate per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/lower_col/upper_col are quoted column-name string literals. NULL [SELECT * FROM ts_coverage_by((SELECT product_id, date, actual, lower, upper FROM results), 'date', 'actual', 'lower', 'upper')]
ts_cv_folds_by table_macro Generates cross-validation fold definitions (cutoff dates) without splitting the data. NULL [SELECT * FROM ts_cv_folds_by('sales', product_id, date, qty, 3, 12, '1d')]
ts_cv_forecast_by table_macro Runs forecasts on all cross-validation folds and returns predictions with fold metadata. NULL [SELECT * FROM ts_cv_forecast_by('cv_splits', product_id, date, qty, 'AutoETS')]
ts_cv_hydrate_by table_macro Joins external features to CV splits with proper masking to prevent data leakage. NULL [SELECT * FROM ts_cv_hydrate_by('cv_splits', product_id, date, qty, 'features', unknown_cols)]
ts_cv_split_by table_macro Creates cross-validation train/test splits from explicit fold boundary dates. NULL [SELECT * FROM ts_cv_split_by('sales', product_id, date, qty, 'folds', fold_id, cutoff)]
ts_cv_split_folds_by table_macro Splits time series into cross-validation folds with configurable gap, embargo, and window parameters. NULL [SELECT * FROM ts_cv_split_folds_by('sales', product_id, date, qty, 3, 12, '1d')]
ts_cv_split_index_by table_macro Memory-efficient cross-validation split using row indices instead of full data copies. NULL [SELECT * FROM ts_cv_split_index_by('sales', product_id, date, qty, 3, 12, '1d')]
ts_data_quality table_macro Assesses time series data quality per group (dates/frequency-aware gap and temporal scoring; n_short drives is_short), returning null rate, gap rate (n_gaps = missing periods, n_gap_runs = gap occurrences), duplicate count, and quality score. NULL [SELECT * FROM ts_data_quality('sales', product_id, date, qty, 10, '1d')]
ts_data_quality_agg aggregate Aggregate function: assesses time series data quality for each group (dates/frequency-aware; n_short=30), reporting null counts, gap counts (n_gaps = missing periods, n_gap_runs = gap occurrences), duplicates, is_short, and quality score. NULL [SELECT product_id, ts_data_quality_agg(date, value) FROM sales GROUP BY product_id]
ts_data_quality_by table_macro Alias for ts_data_quality. Assesses time series data quality per group (dates/frequency-aware). NULL [SELECT * FROM ts_data_quality_by('sales', product_id, date, qty, 10, '1d')]
ts_data_quality_summary table_macro Summarizes ts_data_quality output across all groups into aggregate quality metrics (auto-detected frequency per series). n_unassessed counts groups whose quality struct is NULL (e.g. all dates NULL after filtering), so that n_good + n_fair + n_poor + n_unassessed = n_total; avg_score is the mean overall_score over assessed groups only. NULL [SELECT * FROM ts_data_quality_summary('sales', product_id, date, qty, 10)]
ts_decompose_seasonal scalar Decomposes a time series into trend, seasonal, and remainder components. method is one of: additive (default, fdars LOESS+Fourier), multiplicative (fdars LOESS+Fourier), classical_additive (alias classical, R stats::decompose centred moving-average trend), classical_multiplicative (R stats::decompose). classical_* requires an integer period >= 2; classical_multiplicative additionally requires every value > 0. NULL [ts_decompose_seasonal(LIST(value ORDER BY date), 7), ts_decompose_seasonal(LIST(value ORDER BY date), 12, 'classical_additive')]
ts_detect_amplitude_modulation scalar Detects amplitude modulation in a seasonal time series, identifying whether peak amplitudes vary significantly over time. Returns STRUCT with modulation type, score, and amplitude trend. NULL [ts_detect_amplitude_modulation(LIST(value ORDER BY date), 7)]
ts_detect_changepoints table_macro Detects structural changepoints in a single time series using Bayesian Online Changepoint Detection. NULL [SELECT * FROM ts_detect_changepoints('sales', product_id, date, qty)]
ts_detect_changepoints_agg aggregate Aggregate function: detects structural changepoints in time series for each group using Bayesian Online Changepoint Detection (BOCPD). NULL [SELECT product_id, ts_detect_changepoints_agg(date, value, MAP{}) FROM sales GROUP BY product_id]
ts_detect_changepoints_by table_macro Detects structural changepoints for each group using Bayesian Online Changepoint Detection. NULL [SELECT * FROM ts_detect_changepoints_by('sales', product_id, date, qty)]
ts_detect_multiple_periods scalar Detects multiple seasonal periods simultaneously, returning a ranked list of period candidates with confidence scores. NULL [ts_detect_multiple_periods(LIST(value ORDER BY date))]
ts_detect_peaks scalar Detects peaks in a time series array using prominence-based peak finding. Returns STRUCT with peak indices and properties. NULL [ts_detect_peaks(LIST(value ORDER BY date)), ts_detect_peaks(LIST(value ORDER BY date), MAP{'min_prominence': '0.5'})]
ts_detect_peaks table_macro Detects peaks in a single time series, returning peak indices, values, and prominence scores. NULL [SELECT * FROM ts_detect_peaks('sales', product_id, date, qty)]
ts_detect_peaks_by table_macro Detects peaks in each group's time series, returning peak indices, values, and prominence scores. NULL [SELECT * FROM ts_detect_peaks_by('sales', product_id, date, qty)]
ts_detect_periods table_macro Detects seasonal periods for a single time series, returning ranked period candidates with confidence scores. NULL [SELECT * FROM ts_detect_periods('sales', product_id, date, qty)]
ts_detect_periods_agg aggregate Aggregate function: detects seasonal periods for each group, returning the primary period, confidence, and a ranked list of candidates. NULL [SELECT product_id, ts_detect_periods_agg(date, value) FROM sales GROUP BY product_id]
ts_detect_periods_agg aggregate Aggregate function: detects seasonal periods for each group, returning the primary period, confidence, and a ranked list of candidates. NULL [SELECT product_id, ts_detect_periods_agg(date, value, MAP{'method': 'auto'}) FROM sales GROUP BY product_id]
ts_detect_periods_by table_macro Detects seasonal periods for each group, returning ranked period candidates with confidence scores. NULL [SELECT * FROM ts_detect_periods_by('sales', product_id, date, qty)]
ts_detect_seasonality scalar Tests whether a time series exhibits statistically significant seasonality. Returns TRUE/FALSE or a confidence score. NULL [ts_detect_seasonality(LIST(value ORDER BY date)), ts_detect_seasonality(LIST(value ORDER BY date), 7)]
ts_detect_seasonality_changes scalar Detects structural changes in seasonal patterns over time, returning periods where seasonality changes significantly. NULL [ts_detect_seasonality_changes(LIST(value ORDER BY date), 7)]
ts_detrend scalar Removes the trend component from a time series. method is one of: linear, quadratic (alias polynomial, poly), cubic, diff (alias diff1, difference), diff2, loess (alias lowess), auto (default); an unknown method raises an error naming the valid choices. NULL [ts_detrend(LIST(value ORDER BY date), 'linear')]
ts_detrend_by table_macro Removes the trend component from each group's time series. NULL [SELECT * FROM ts_detrend_by('sales', product_id, date, qty, 'cubic')]
ts_diff_by table_macro Computes d-th order differences for each group's time series in Rust (numpy diff(n=diff_order)): value[t] - value[t-1] applied diff_order times. seasonal_lag (default 1) sets the lag-k difference step for the old lag-based semantics (R diff(x, lag=seasonal_lag, differences=diff_order)). One row per input row; the first diff_order*seasonal_lag rows per group are NULL. Any difference touching a NULL input is NULL (never an error). NULL [SELECT * FROM ts_diff_by('sales', product_id, date, qty, 2) – or: …, 1, seasonal_lag := 2)]
ts_drop_constant_by table_macro Removes groups whose time series classify as constant under the Rust is_constant tolerance (scale-relative: max - min <= 1e-10 * max(1, max|x|) over non-NULL/non-NaN values, D-13): fewer than two present values (including an all-NULL group), or all present values within that scale-relative tolerance of each other. NULL [SELECT * FROM ts_drop_constant_by('sales', product_id, date, qty)]
ts_drop_edge_zeros_by table_macro Removes both leading and trailing zeros from each group's time series. NULL [SELECT * FROM ts_drop_edge_zeros_by('sales', product_id, date, qty)]
ts_drop_gappy_by table_macro Removes groups whose time series have a gap rate exceeding a threshold. NULL [SELECT * FROM ts_drop_gappy_by('sales', product_id, date, qty, '1d', 0.1)]
ts_drop_leading_zeros_by table_macro Removes leading zeros from each group's time series, trimming the start of the series. NULL [SELECT * FROM ts_drop_leading_zeros_by('sales', product_id, date, qty)]
ts_drop_short_by table_macro Removes groups with fewer observations than the specified minimum length. NULL [SELECT * FROM ts_drop_short_by('sales', product_id, date, qty, 20)]
ts_drop_trailing_zeros_by table_macro Removes trailing zeros from each group's time series, trimming the end of the series. NULL [SELECT * FROM ts_drop_trailing_zeros_by('sales', product_id, date, qty)]
ts_drop_zeros_by table_macro Removes groups whose time series are predominantly zero values. NULL [SELECT * FROM ts_drop_zeros_by('sales', product_id, date, qty, 0.8)]
ts_durbin_watson scalar Durbin-Watson first-order autocorrelation statistic on residuals. Returns STRUCT(statistic DOUBLE, interpretation VARCHAR); statistic in [0,4], ~2 means no autocorrelation. interpretation is one of positive_strong / positive_weak / none / negative_weak / negative_strong. NULL [ts_durbin_watson(LIST(resid ORDER BY ds))]
ts_durbin_watson_by table_macro Durbin-Watson first-order autocorrelation statistic on residuals per group. Returns STRUCT(statistic, interpretation); statistic in [0,4], ~2 means no autocorrelation. NULL [SELECT group_col, (durbin_watson).statistic FROM ts_durbin_watson_by('resids', product_id, ds, e)]
ts_ensemble_inspect_by table_macro Returns per-member combination weights for an explicit-member ensemble. One row per (group, member). weight sums to 1.0 per group for all six combination methods. score column is NULL (use ts_auto_ensemble_inspect_by for AutoEnsemble in-sample MSE scores). combination_method: 'mean' (default), 'median', 'weighted_mse', 'inverse_aic', 'stacking', 'horizon_adaptive'. HorizonAdaptive returns the AVERAGE per-horizon weight (per-step matrix out of scope for INSP-01 v1). NULL [SELECT * FROM ts_ensemble_inspect_by('sales', id, ds, y, ['AutoARIMA','AutoETS','Naive'], combination_method := 'weighted_mse')]
ts_estimate_backtest_memory scalar Estimates memory usage in MB for a ts_cv_folds_by + ts_cv_forecast_by two-step cross-validation run given series count, length, folds, and horizon. NULL [ts_estimate_backtest_memory(100, 365, 3, 30)]
ts_estimate_period_acf scalar Estimates the seasonal period using the Autocorrelation Function (ACF) by finding the lag of maximum autocorrelation. NULL [ts_estimate_period_acf(LIST(value ORDER BY date))]
ts_estimate_period_fft scalar Estimates the dominant seasonal period using Fast Fourier Transform spectral analysis. NULL [ts_estimate_period_fft(LIST(value ORDER BY date))]
ts_features aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, ts_features(date, value) FROM sales GROUP BY product_id]
ts_features aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, ts_features(date, value, ['mean', 'std_dev']) FROM sales GROUP BY product_id]
ts_features aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, ts_features(date, value, ['mean'], NULL) FROM sales GROUP BY product_id]
ts_features_agg aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, ts_features_agg(date, value) FROM sales GROUP BY product_id]
ts_features_agg aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, ts_features_agg(date, value, ['mean'], NULL) FROM sales GROUP BY product_id]
ts_features_agg aggregate Aggregate function: extracts 117 tsfresh-compatible time series features for each group. Returns a STRUCT with all computed features. NULL [SELECT product_id, ts_features_agg(date, value, config) FROM sales GROUP BY product_id]
ts_features_by table_macro Extracts time series features for each group and returns results as a structured table. NULL [SELECT * FROM ts_features_by('sales', product_id, date, qty)]
ts_features_config_from_csv scalar Parses a CSV string of feature names into a feature configuration for use with ts_features_by(). NULL [ts_features_config_from_csv('mean,std,skewness')]
ts_features_config_from_json scalar Parses a feature configuration JSON string for use with ts_features_by() to select specific features. NULL [ts_features_config_from_json('{"features": ["mean", "std"]}')]
ts_features_config_template table Returns a JSON template for configuring which features to compute with ts_features_by(). NULL [SELECT * FROM ts_features_config_template()]
ts_features_list table Returns a table listing all 117 available tsfresh-compatible feature names and their categories. NULL [SELECT * FROM ts_features_list()]
ts_features_table table_macro Extracts 117 tsfresh-compatible features and returns them as a wide table (one column per feature). NULL [SELECT * FROM ts_features_table('sales', product_id, date, qty)]
ts_fill_forward_by table_macro Forward-fills missing timestamps in each group's time series using the last known value. NULL [SELECT * FROM ts_fill_forward_by('sales', product_id, date, qty, '1d')]
ts_fill_forward_operator table Native table function: forward-fills NULL values in time series within groups. Used internally by ts_fill_forward_by(). NULL [SELECT * FROM ts_fill_forward_operator(source_table, group_col, date_col, value_col, target_date, frequency)]
ts_fill_gaps_by table_macro Fills missing timestamps in each group's time series to create a regular frequency grid. NULL [SELECT * FROM ts_fill_gaps_by('sales', product_id, date, qty, '1d')]
ts_fill_nulls_backward_by table_macro Backward-fills NULL values in each group's time series using the next known value. NULL [SELECT * FROM ts_fill_nulls_backward_by('sales', product_id, date, qty)]
ts_fill_nulls_const_by table_macro Fills NULL values in each group's time series with a constant value. NULL [SELECT * FROM ts_fill_nulls_const_by('sales', product_id, date, qty, 0.0)]
ts_fill_nulls_forward_by table_macro Forward-fills NULL values in each group's time series using the last known value. NULL [SELECT * FROM ts_fill_nulls_forward_by('sales', product_id, date, qty)]
ts_fill_nulls_mean_by table_macro Fills NULL values in each group's time series with the group mean, computed in Rust (fill_nulls_mean): NaN counts as missing; an all-NULL/all-NaN group keeps every value NULL. All input columns are preserved. NULL [SELECT * FROM ts_fill_nulls_mean_by('sales', product_id, date, qty)]
ts_fill_unknown_by table_macro Fills unknown (NULL) feature values using a specified strategy for cross-validation. NULL [SELECT * FROM ts_fill_unknown_by('cv_data', product_id, date, feature_col, 'last_value')]
ts_forecast table_macro Generates a forecast for a single time series. Returns point forecasts with prediction intervals. NULL [SELECT * FROM ts_forecast('sales', product_id, date, qty, 'AutoETS', 12, '1d')]
ts_forecast_agg aggregate Aggregate function: produces a time series forecast for each group. Supports 32 forecasting models. Returns STRUCT(point[], lower[], upper[], fitted[], residuals[], model, aic, bic, mse). NULL [SELECT product_id, ts_forecast_agg(date, value, 'AutoETS', 12, MAP{}) FROM sales GROUP BY product_id]
ts_forecast_by table_macro Generates forecasts for multiple time series grouped by one or more keys. Returns point forecasts with prediction intervals. NULL [SELECT * FROM ts_forecast_by('sales', product_id, date, qty, 'AutoETS', 12, '1d')]
ts_forecast_ensemble_by table_macro Generates ensemble forecasts from explicitly named member models per series. members is a VARCHAR[] list (e.g. ['AutoARIMA','AutoETS','Naive']). combination_method: 'mean' (default), 'median', 'weighted_mse', 'inverse_aic', 'stacking', 'horizon_adaptive'. yhat_lower / yhat_upper are the crate Ensemble's own prediction interval at confidence_level (default 0.90). NULL [SELECT * FROM ts_forecast_ensemble_by('sales', product_id, date, qty, ['AutoARIMA','AutoETS','Naive'], 12, '1d')]
ts_forecast_exog table_macro Generates a forecast for a single time series using exogenous regressors. NULL [SELECT * FROM ts_forecast_exog('sales', product_id, date, qty, 'future_features', 'AutoARIMA', 12, '1d')]
ts_forecast_exog_by table_macro Generates forecasts for multiple time series using exogenous regressors. NULL [SELECT * FROM ts_forecast_exog_by('sales', product_id, date, qty, 'future_features', 'AutoARIMA', 12, '1d')]
ts_forecast_explain_by table_macro Returns per-horizon forecast decomposition (level, trend, seasonal, residual) per group as a wide STRUCT. Supports ETS, MSTL, Theta. NULL [SELECT group_col, (decomposition).trend, (decomposition).seasonal FROM ts_forecast_explain_by('sales', product_id, ds, y, 'ETS', 12, {seasonal_period: 12})]
ts_forecast_inspect_by table_macro Returns per-group Inspectable fit-state snapshot (coefficients, AIC/BIC, components, residuals) as a wide STRUCT. NULL [SELECT group_col, (inspection).spec, (inspection).aic FROM ts_forecast_inspect_by('sales', product_id, ds, y, 'AutoETS')]
ts_forecast_panel_by table_macro Forecasts a grouped panel using cross-series global learners (GlobalETS, GlobalTheta, GlobalCroston). All series are fitted simultaneously with shared parameters (fit-once-emit-many). Ragged panels are auto-aligned to a shared date grid before the global fit. Returns one row per (group, horizon step). Series with fewer than 10 valid observations are surfaced with model_name = 'DROPPED: too_short'. NULL [SELECT * FROM ts_forecast_panel_by('sales', product_id, date, qty, 'GlobalETS', 14, '1d', MAP{'seasonal_period': '7'})]
ts_forecast_var_by table_macro VAR multivariate forecasting. Fits a single VAR(p) model across all K value columns and returns one row per (variable, horizon step) in long format (LONG output shape). value_cols is a VARCHAR[] of column names from source (e.g. ['y1','y2']). date_col is the name of the date column (VARCHAR string, e.g. 'ds'). p is the VAR lag order (default 1). forecast_value is a point forecast (no prediction intervals in v1). v1 is single-panel only (no group_col — one VAR fit for the entire input table). NULL [SELECT * FROM ts_forecast_var_by('returns', 'ds', ['equity','bond','fx'], 12, '1d', p:=2)]
ts_instantaneous_period scalar Estimates the instantaneous period of a time series using the Hilbert transform analytic signal method. Returns STRUCT(periods[], frequencies[], amplitudes[]). NULL [ts_instantaneous_period(LIST(value ORDER BY date))]
ts_interval_width_by table_macro Computes the mean width of prediction intervals for each group, pairing lower/upper by date_col. NULL [SELECT * FROM ts_interval_width_by('forecasts', product_id, date, lower, upper)]
ts_jarque_bera scalar Jarque-Bera normality test on residuals. Returns STRUCT(statistic DOUBLE, p_value DOUBLE, skewness DOUBLE, excess_kurtosis DOUBLE). A small p-value rejects normality. NULL [ts_jarque_bera(LIST(resid ORDER BY ds))]
ts_jarque_bera_by table_macro Jarque-Bera normality test on residuals per group. Returns STRUCT(statistic, p_value, skewness, excess_kurtosis). A small p-value rejects normality. NULL [SELECT group_col, (jarque_bera).p_value FROM ts_jarque_bera_by('resids', product_id, ds, e)]
ts_kpss scalar Kwiatkowski-Phillips-Schmidt-Shin (KPSS) stationarity test, matching tseries::kpss.test(lshort = TRUE). Returns STRUCT(statistic DOUBLE, p_value DOUBLE, lags BIGINT, is_stationary BOOLEAN, cv_1pct DOUBLE, cv_5pct DOUBLE, cv_10pct DOUBLE); is_stationary=true means the null is NOT rejected at 5%. regression is 'c' (level, null = "Level", default) or 'ct' (trend, null = "Trend"); NULL means 'c'. p-values are approximate (interpolated, clamped to [0.01, 0.10]). Returns NaN statistic/p_value/critical values for series shorter than 4 observations or (under 'ct') an exactly-collinear trend fit. NULL [ts_kpss(LIST(y ORDER BY ds)), ts_kpss(LIST(y ORDER BY ds), 4), ts_kpss(LIST(y ORDER BY ds), -1, 'ct')]
ts_kpss_by table_macro KPSS stationarity test per group. Returns STRUCT(statistic, p_value, lags, is_stationary, cv_1pct, cv_5pct, cv_10pct) per group. Pass lags:=N to override the automatic bandwidth. regression:='c' (level, null hypothesis is level-stationarity, default) or regression:='ct' (trend). is_stationary=true means the null is not rejected at 5%. NULL [SELECT group_col, (kpss).statistic, (kpss).is_stationary FROM ts_kpss_by('sales', product_id, ds, y, regression := 'ct')]
ts_ljung_box scalar Ljung-Box white-noise test on residuals. Returns STRUCT(statistic DOUBLE, p_value DOUBLE, lags BIGINT, df BIGINT). Default lags = min(10, n/5); df = lags - fitted_params (default fitted_params 0). Pass fitted_params := p + q for ARMA(p, q) residuals to get R Box.test(fitdf = p + q)-matching p-values; fitted_params >= the effective lags is a SQL error. A large statistic / small p-value indicates residual autocorrelation. NULL [ts_ljung_box(LIST(resid ORDER BY ds)), ts_ljung_box(LIST(resid ORDER BY ds), 12), ts_ljung_box(LIST(resid ORDER BY ds), 10, 2)]
ts_ljung_box_by table_macro Ljung-Box white-noise test on residuals per group. Returns STRUCT(statistic, p_value, lags, df). value_col should be model residuals; default lags = min(10, n/5). Pass lags:=N to override. df = lags - fitted_params; pass fitted_params := p + q for ARMA(p, q) residuals to get R Box.test(fitdf = p + q)-matching p-values (fitted_params >= the effective lags is a SQL error). NULL [SELECT group_col, (ljung_box).p_value FROM ts_ljung_box_by('resids', product_id, ds, e, fitted_params := 2)]
ts_lomb_scargle scalar Estimates the dominant period using the Lomb-Scargle periodogram, suitable for unevenly-sampled time series. Raises an error for n_frequencies < 2, a non-positive or non-finite min_period/max_period, or min_period >= max_period; a default-derived range made impossible by a too-short series returns NULL. NULL [ts_lomb_scargle(LIST(value ORDER BY date))]
ts_mae scalar Computes Mean Absolute Error (MAE) between actual and predicted value arrays. NULL [ts_mae(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
ts_mae_by table_macro Computes Mean Absolute Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mae_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
ts_mape scalar Computes Mean Absolute Percentage Error (MAPE) between actual and predicted value arrays. Returns NULL if any actual value is exactly zero (MAPE is undefined there); use ts_smape or ts_mase for intermittent-demand series. NULL [ts_mape(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
ts_mape_by table_macro Computes Mean Absolute Percentage Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mape_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
ts_mark_unknown_by table_macro Marks future values as unknown (NULL) for cross-validation leakage prevention. NULL [SELECT * FROM ts_mark_unknown_by('features', product_id, date, feature_col, cutoff_date)]
ts_mase scalar Computes Hyndman-Koehler Mean Absolute Scaled Error (MASE): the out-of-sample forecast MAE scaled by the in-sample seasonal-naive MAE at lag seasonal_period. The old 3-argument (actual, forecast, baseline) form was removed in v2026.10.16 (it computed a relative MAE, not MASE) – use ts_rmae for that. NULL [ts_mase(LIST(actual ORDER BY date), LIST(forecast ORDER BY date), LIST(insample ORDER BY date), 12)]
ts_mase_by table_macro Computes Hyndman-Koehler Mean Absolute Scaled Error (MASE) per group: the out-of-sample forecast MAE scaled by the in-sample seasonal-naive MAE at lag seasonal_period (default 1). Source rows dated before each group's first forecast (forecast NULL) supply the in-sample scale. The old baseline-column form was removed in v2026.10.16 – use ts_rmae_by for a relative-MAE comparison. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mase_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast', seasonal_period := 4)]
ts_matrix_profile_period scalar Estimates the seasonal period using Matrix Profile motif discovery. NULL [ts_matrix_profile_period(LIST(value ORDER BY date))]
ts_mean_interval_width scalar Computes the mean width of prediction intervals: average of (upper - lower) across all steps. NULL [ts_mean_interval_width(lower, upper)]
ts_mqloss scalar Computes Mean Quantile Loss (MQLoss) across multiple quantile levels. NULL [ts_mqloss(LIST(actual ORDER BY date), LIST([lower, upper] ORDER BY date), [0.1, 0.9])]
ts_mse scalar Computes Mean Squared Error (MSE) between actual and predicted value arrays. NULL [ts_mse(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
ts_mse_by table_macro Computes Mean Squared Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_mse_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
ts_mstl_decomposition_by table_macro Decomposes each group's time series into trend, seasonal, and remainder components using MSTL. params: seasonal_periods (alias periods) is a list of seasonal periods to extract, e.g. '[7, 365]' or [7, 365]; insufficient_data is 'fail' (default), 'trend', or 'none'. NULL [SELECT * FROM ts_mstl_decomposition_by('sales', product_id, date, qty, MAP{'seasonal_periods': '[7, 365]'})]
ts_quality_report table_macro Generates a data quality report with null counts, gap counts, duplicate timestamps, and quality score per group. NULL [SELECT * FROM ts_quality_report('sales', product_id, date, qty)]
ts_quantile_loss scalar Computes the quantile (pinball) loss for a single quantile level. NULL [ts_quantile_loss(LIST(actual ORDER BY date), LIST(forecast ORDER BY date), 0.9)]
ts_quantile_loss_by table_macro Computes quantile (pinball) loss at a specified quantile level per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_quantile_loss_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast', 0.9)]
ts_r2 scalar Computes the R-squared (coefficient of determination) between actual and predicted value arrays. NULL [ts_r2(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
ts_r2_by table_macro Computes R-squared (coefficient of determination) between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_r2_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
ts_residual_diagnostics scalar Combined residual adequacy report: Ljung-Box + Durbin-Watson + Jarque-Bera. Returns STRUCT(lb_statistic, lb_p_value, lb_lags, dw_statistic, dw_interpretation, jb_statistic, jb_p_value, jb_skewness, jb_excess_kurtosis, adequate BOOLEAN). adequate = (lb_p_value > alpha); alpha defaults to 0.05. Jarque-Bera and Durbin-Watson are advisory and do not affect the adequacy verdict. NULL [ts_residual_diagnostics(LIST(resid ORDER BY ds)), ts_residual_diagnostics(LIST(resid ORDER BY ds), 0.01)]
ts_residual_diagnostics_by table_macro Combined residual adequacy report per group: Ljung-Box + Durbin-Watson + Jarque-Bera. Returns STRUCT(lb_statistic, lb_p_value, lb_lags, dw_statistic, dw_interpretation, jb_statistic, jb_p_value, jb_skewness, jb_excess_kurtosis, adequate). adequate = (lb_p_value > alpha), alpha default 0.05. NULL [SELECT group_col, (residual_diagnostics).adequate FROM ts_residual_diagnostics_by('resids', product_id, ds, e)]
ts_rmae scalar Computes Relative MAE: ratio of MAE(actual, pred1) to MAE(actual, pred2). Values < 1 mean pred1 is better. NULL [ts_rmae(LIST(actual ORDER BY date), LIST(model_a ORDER BY date), LIST(model_b ORDER BY date))]
ts_rmae_by table_macro Computes Relative MAE (MAE ratio between two models) per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/pred1_col/pred2_col are quoted column-name string literals. NULL [SELECT * FROM ts_rmae_by((SELECT product_id, date, actual, pred1, pred2 FROM results), 'date', 'actual', 'pred1', 'pred2')]
ts_rmse scalar Computes Root Mean Squared Error (RMSE) between actual and predicted value arrays. NULL [ts_rmse(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
ts_rmse_by table_macro Computes Root Mean Squared Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_rmse_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
ts_sazed_period scalar Estimates the seasonal period using the SAZED (Self-Adaptive Zero-crossing Estimation of Dominant period) algorithm. NULL [ts_sazed_period(LIST(value ORDER BY date))]
ts_seasonal_strength scalar Computes the seasonal strength metric (0-1) indicating how strongly seasonal patterns dominate the time series. The series is linearly detrended first. method is 'variance' (default, alias var) or 'spectral' (alias spec, fft); 'wavelet' is removed (it returned 1.0 even for white noise) and raises an error, as does any other unrecognized method name or a non-positive period. NULL [ts_seasonal_strength(LIST(value ORDER BY date), 7)]
ts_seasonal_strength_windowed scalar Computes rolling seasonal strength over a sliding window, returning strength estimates per window position. Each window is linearly detrended first. method is 'variance' (default, alias var) or 'spectral' (alias spec, fft); 'wavelet' is removed and raises an error, as does any other unrecognized method name or a non-positive period. NULL [ts_seasonal_strength_windowed(LIST(value ORDER BY date), 7, 52)]
ts_smape scalar Computes Symmetric Mean Absolute Percentage Error (sMAPE) between actual and predicted value arrays. NULL [ts_smape(LIST(actual ORDER BY date), LIST(forecast ORDER BY date))]
ts_smape_by table_macro Computes Symmetric Mean Absolute Percentage Error between actual and forecast columns per group. source must be a subquery, e.g. (SELECT …) – a bare table name fails to bind (the first native-function parameter is TABLE-typed); date_col/actual_col/forecast_col are quoted column-name string literals. NULL [SELECT * FROM ts_smape_by((SELECT product_id, date, actual, forecast FROM results), 'date', 'actual', 'forecast')]
ts_split_keys table Splits a composite group key column back into its original multiple key columns. NULL [SELECT * FROM ts_split_keys(TABLE(SELECT unique_id, date, value FROM t), separator='|', columns=['region', 'store', 'item'])]
ts_ssa_period scalar Estimates the seasonal period using Singular Spectrum Analysis (SSA). NULL [ts_ssa_period(LIST(value ORDER BY date))]
ts_stationarity scalar Combined ADF + KPSS stationarity verdict (D-04). Runs both tests (with the SAME regression applied to both) and returns STRUCT(adf_statistic DOUBLE, adf_p_value DOUBLE, kpss_statistic DOUBLE, kpss_p_value DOUBLE, adf_is_stationary BOOLEAN, kpss_is_stationary BOOLEAN, verdict VARCHAR). verdict is one of 'stationary' (ADF rejects, KPSS does not), 'non_stationary' (ADF does not reject, KPSS rejects), 'trend_stationary' (neither rejects), 'difference_stationary' (both reject), or 'constant' (n >= 2, all values equal); verdict is SQL NULL when either test's statistic is NaN (too-short series, or an exactly-collinear regression). regression is 'c' (default) or 'ct'; NULL means 'c'. NULL [ts_stationarity(LIST(y ORDER BY ds)), ts_stationarity(LIST(y ORDER BY ds), 'ct')]
ts_stationarity_by table_macro Combined ADF + KPSS stationarity verdict per group (D-04). Returns STRUCT(adf_statistic, adf_p_value, kpss_statistic, kpss_p_value, adf_is_stationary, kpss_is_stationary, verdict) per group. verdict is one of 'stationary', 'non_stationary', 'trend_stationary', 'difference_stationary', 'constant', or NULL (degenerate series). regression:='c' (default, applies to both tests) or regression:='ct'. NULL [SELECT group_col, (stationarity).verdict FROM ts_stationarity_by('sales', product_id, ds, y, regression := 'ct')]
ts_stats table_macro Computes 36 time series statistics per group (including n_gap_runs). trend_strength/seasonality_strength are STL-based (D-02); seasonal_period (default 0) selects 0=auto-detect, 1=non-seasonal, >=2=explicit period. Returns a wide table with one column per statistic. NULL [SELECT * FROM ts_stats('sales', product_id, date, qty, '1d', seasonal_period := 12)]
ts_stats_agg aggregate Aggregate function: computes 36 time series statistics for each group (including n_gap_runs). Returns a STRUCT with mean, std, min, max, trend, seasonality, and many more. NULL [SELECT product_id, ts_stats_agg(date, value) FROM sales GROUP BY product_id]
ts_stats_by table_macro Alias for ts_stats. Computes 36 time series statistics per group (including n_gap_runs). seasonal_period (default 0) selects 0=auto-detect, 1=non-seasonal, >=2=explicit period for the STL-based trend_strength/seasonality_strength. NULL [SELECT * FROM ts_stats_by('sales', product_id, date, qty, '1d', seasonal_period := 12)]
ts_stats_summary table_macro Aggregates ts_stats output across all groups into summary statistics (mean, std, min, max per metric). NULL [SELECT * FROM ts_stats_summary('sales', product_id, date, qty, '1d')]
ts_stl_period scalar Estimates the seasonal period using Seasonal and Trend decomposition using Loess (STL). NULL [ts_stl_period(LIST(value ORDER BY date))]
ts_validate_separator table Validates that group key separators in composite keys are consistent and non-ambiguous. NULL [SELECT * FROM ts_validate_separator(TABLE(SELECT region, store FROM t), separator='|')]
ts_validate_timestamps_by table_macro Validates that timestamps are unique, monotonically increasing, and match the expected frequency per group. NULL [SELECT * FROM ts_validate_timestamps_by('sales', product_id, date, qty, '1d')]
ts_validate_timestamps_summary_by table_macro Summarizes ts_validate_timestamps_by results across all groups. NULL [SELECT * FROM ts_validate_timestamps_summary_by('sales', product_id, date, qty, '1d')]

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

name description input_type scope aliases typed_value
anofox_telemetry_enabled Enable or disable anonymous usage telemetry for anofox_forecast BOOLEAN GLOBAL [] true
datazoo_banner Show the DataZoo feedback banner when an extension is loaded in an interactive terminal (at most once a day per extension). BOOLEAN GLOBAL [] true
temp_directory Set the directory to which temporary files are written. VARCHAR GLOBAL [] post.db.tmp