category

forecaster_common

Shared predicates for forecaster diagnostics, dataset validation, differencing, lag construction, error metrics, seasonal adjustment, and baselines.

Availability:
logtalk_load(time_series_protocols(loader))
Author: Paulo Moura
Version: 1:0:0
Date: 2026-10-18
Compilation flags:
static
Implements:
Extends:
public options
Uses:
Remarks:
(none)

Public predicates

(no local declarations; see entity ancestors if any)

Protected predicates

forecaster_diagnostics_data/2

Hook predicate that importing forecaster implementations must define in order to expose diagnostics metadata. A default implementation is provided that assumes the diagnostics list is the last argument of the forecaster term; concrete implementations following that convention do not need to override it.

Compilation flags:
static
Template:
forecaster_diagnostics_data(Forecaster,Diagnostics)
Mode and number of proofs:
forecaster_diagnostics_data(+compound,-list(compound)) - one

forecaster_export_template/4

Hook predicate that importing forecaster implementations must define in order to expose the exported forecaster template for a given functor.

Compilation flags:
static
Template:
forecaster_export_template(Dataset,Forecaster,Functor,Template)
Mode and number of proofs:
forecaster_export_template(+object_identifier,+compound,+atom,-callable) - one

forecaster_term_template/2

Hook predicate that importing forecaster implementations must define in order to expose the learned forecaster term template used by pretty-printing helpers.

Compilation flags:
static
Template:
forecaster_term_template(Forecaster,Template)
Mode and number of proofs:
forecaster_term_template(+compound,-callable) - one

dataset_series/2

Collects the dataset time-ordered observation values. Checks that the observation indices form a complete, gap-free, 1-based sequence and that the declared series length matches the observed length.

Compilation flags:
static
Template:
dataset_series(Dataset,Series)
Mode and number of proofs:
dataset_series(+object_identifier,-list) - one_or_error
Exceptions:
The dataset contains no observations:
domain_error(non_empty_series,Dataset)
The observation indices do not form a complete, gap-free, 1-based sequence:
domain_error(series_index_sequence,Dataset)
An observation index or the declared series length is a variable:
instantiation_error
The declared series length is neither a variable nor an integer:
type_error(integer,DeclaredLength)
The declared series length is an integer but is not positive:
domain_error(positive_integer,DeclaredLength)
The declared and observed series lengths differ:
consistency_error(series_length,DeclaredLength,ObservedLength)
Index arithmetic raises an evaluation error:
evaluation_error(Error)

check_series/2

Checks that a time series is non-empty and that every observation value is a number.

Compilation flags:
static
Template:
check_series(Dataset,Series)
Mode and number of proofs:
check_series(+object_identifier,+list) - one_or_error
Exceptions:
Series is a partial list or a list with an element which is a variable:
instantiation_error
An element Value of the Series list is neither a variable nor a number:
type_error(number,Value)
Series is empty:
domain_error(non_empty_series,Dataset)

check_series/3

Checks that a time series is non-empty and that every observation value is of one of the given types.

Compilation flags:
static
Template:
check_series(Dataset,Series,Types)
Mode and number of proofs:
check_series(+object_identifier,+list,+list) - one_or_error
Exceptions:
Series is a partial list:
instantiation_error
An element Value of the Series list is neither a variable nor a number:
domain_error(types(Types),Value)
Series is empty:
domain_error(non_empty_series,Dataset)

check_series_length/3

Checks that a time series has at least the given minimum number of observations.

Compilation flags:
static
Template:
check_series_length(Dataset,Series,MinimumLength)
Mode and number of proofs:
check_series_length(+object_identifier,+list,+non_negative_integer) - one_or_error
Exceptions:
MinimumLength is a variable:
instantiation_error
MinimumLength is neither a variable nor an integer:
type_error(integer,MinimumLength)
MinimumLength is an integer but is negative:
domain_error(non_negative_integer,MinimumLength)
Series is shorter than MinimumLength:
domain_error(series_length,Dataset)

check_observation/1

Checks that an observation is a number or an unbound variable representing a missing observation.

Compilation flags:
static
Template:
check_observation(Observation)
Mode and number of proofs:
check_observation(@term) - one_or_error
Exceptions:
Observation is neither a variable nor a number:
type_error(number,Observation)

series_observation_summary/4

Returns the elapsed length, numeric observation count, and numeric sum of a series. Unbound observations are counted in the length only and are not instantiated. An empty list has zero length, count, and sum.

Compilation flags:
static
Template:
series_observation_summary(Series,Length,ObservedCount,Sum)
Mode and number of proofs:
series_observation_summary(+list,-non_negative_integer,-non_negative_integer,-number) - one_or_error
Exceptions:
Series is a variable or a partial list:
instantiation_error
Series is neither a variable nor a list:
type_error(list,Series)
An observation is neither a variable nor a number:
type_error(number,Observation)
Numeric summation raises an arithmetic evaluation error:
evaluation_error(Error)

normalize_missing_series/3

Copies numeric-or-unbound observations, sharing a fresh variable among missing positions without binding input variables.

Compilation flags:
static
Template:
normalize_missing_series(Series,Normalized,Missing)
Mode and number of proofs:
normalize_missing_series(+list,-list,-term) - one_or_error
Exceptions:
The series is unbound or partial:
instantiation_error
The series is not a list:
type_error(list,Series)
A known observation is not numeric:
type_error(number,Value)

indexed_series_observations/3

Collects known numeric values with their original one-based time indices.

Compilation flags:
static
Template:
indexed_series_observations(Series,Indices,Values)
Mode and number of proofs:
indexed_series_observations(+list,-list(positive_integer),-list(number)) - one_or_error
Exceptions:
The list is unbound or partial:
instantiation_error
The series is not a list:
type_error(list,Series)
A known value is not numeric:
type_error(number,Value)
Index arithmetic fails:
evaluation_error(Error)

residual_fitted_values/3

Reconstructs aligned pre-update fits from numeric-or-unbound observations and residuals after the first known initialization anchor. Missing positions and the anchor have fresh independent unbound output placeholders.

Compilation flags:
static
Template:
residual_fitted_values(Series,Residuals,Values)
Mode and number of proofs:
residual_fitted_values(+list,+list(number),-list) - one_or_error
Exceptions:
A list is unbound or partial, or a residual is unbound:
instantiation_error
Series or residuals are not lists:
type_error(list,List)
A known observation or residual is not numeric:
type_error(number,Value)
The residual count differs from the known count minus the initialization anchor:
domain_error(residual_count,Residuals)
Fit reconstruction arithmetic fails:
evaluation_error(Error)

valid_residual_history/5

Validates ground parallel numeric residuals and strictly increasing original indices after the initialization anchor. Both lists must match the scored count. The caller validates finiteness; this predicate does not reconstruct error totals or certify historical observations.

Compilation flags:
static
Template:
valid_residual_history(Residuals,Indices,Anchor,Length,ScoredCount)
Mode and number of proofs:
valid_residual_history(@list,@list,@positive_integer,@positive_integer,@non_negative_integer) - zero_or_one_or_error
Exceptions:
Index or count arithmetic fails:
evaluation_error(Error)

base_forecaster_diagnostics/5

Builds the common part of a forecaster diagnostics metadata list, combined with implementation-specific extra diagnostics terms.

Compilation flags:
static
Template:
base_forecaster_diagnostics(Model,TrainingSeriesLength,Options,ExtraDiagnostics,Diagnostics)
Mode and number of proofs:
base_forecaster_diagnostics(+atom,+integer,+list(compound),+list(compound),-list(compound)) - one

valid_forecaster_metadata/2

True when diagnostics metadata contains the expected model term.

Compilation flags:
static
Template:
valid_forecaster_metadata(Model,Diagnostics)
Mode and number of proofs:
valid_forecaster_metadata(+atom,+list(compound)) - zero_or_one

valid_forecaster_metadata/3

True when diagnostics metadata contains the expected model term and records the given effective options.

Compilation flags:
static
Template:
valid_forecaster_metadata(Model,Options,Diagnostics)
Mode and number of proofs:
valid_forecaster_metadata(+atom,+list(compound),+list(compound)) - zero_or_one

replace_diagnostic/4

Replaces the value of the first unary diagnostic with the given name, preserving order. Fails when no such diagnostic exists.

Compilation flags:
static
Template:
replace_diagnostic(Name,Value,Diagnostics,UpdatedDiagnostics)
Mode and number of proofs:
replace_diagnostic(+atom,+term,+list(compound),-list(compound)) - zero_or_one

updated_observation_diagnostics/3

Updates the training length, update count, observed count, and missing count of validated diagnostics after a numeric or missing observation, preserving metadata order and all other diagnostics. Requires existing non-negative integer counters.

Compilation flags:
static
Template:
updated_observation_diagnostics(Diagnostics,Observation,UpdatedDiagnostics)
Mode and number of proofs:
updated_observation_diagnostics(+list(compound),@term,-list(compound)) - one_or_error
Exceptions:
Observation is neither a variable nor a number:
type_error(number,Observation)
Counter arithmetic raises an evaluation error:
evaluation_error(Error)

difference_series/2

Computes the first-order differences of a series: Differences[i] = Series[i+1] - Series[i]. The result has one fewer element than Series.

Compilation flags:
static
Template:
difference_series(Series,Differences)
Mode and number of proofs:
difference_series(+list(number),-list(number)) - one_or_error
Exceptions:
Series is empty:
domain_error(non_empty_series,Series)

integrate_series/3

Reconstructs a series of levels from a series of differences and a starting base value (typically the last observed original value), by cumulative summing. Used to undo difference_series/2 on forecasted differences.

Compilation flags:
static
Template:
integrate_series(Differences,Base,Series)
Mode and number of proofs:
integrate_series(+list(number),+number,-list(number)) - one

lagged_rows/3

Builds a list of Lags-Target rows from a series, where Lags is a list of the Order most recent values preceding Target, most recent first ([X(t-1), X(t-2), ..., X(t-Order)]-X(t)). Requires the series to have more than Order observations.

Compilation flags:
static
Template:
lagged_rows(Series,Order,Rows)
Mode and number of proofs:
lagged_rows(+list(number),+positive_integer,-list(pair)) - one_or_error
Exceptions:
Order is a variable:
instantiation_error
Order is neither a variable nor an integer:
type_error(integer,Order)
Order is an integer but is not positive:
domain_error(positive_integer,Order)
Series has Order or fewer observations:
domain_error(series_length,Series)

accumulate_forecast_error/4

Adds one numeric actual/prediction error to validated forecast_error_totals(Count, AbsoluteSum, SquaredSum), without retaining observations. Requires a non-negative integer count and non-negative numeric sums; forecast_error_totals(0,0,0) initializes accumulation. Missing observations must be skipped by the caller.

Compilation flags:
static
Template:
accumulate_forecast_error(Actual,Prediction,Totals,UpdatedTotals)
Mode and number of proofs:
accumulate_forecast_error(+number,+number,+compound,-compound) - one_or_error
Exceptions:
Actual or Prediction is a variable:
instantiation_error
Actual or Prediction is not a number:
type_error(number,Value)
Error or total arithmetic raises an evaluation error:
evaluation_error(Error)

forecast_error_metrics/3

Computes MAE and RMSE from validated forecast_error_totals(Count, AbsoluteSum, SquaredSum). Requires non-negative numeric sums and a positive integer count. Does not retain or reconstruct actual/predicted observations.

Compilation flags:
static
Template:
forecast_error_metrics(Totals,MAE,RMSE)
Mode and number of proofs:
forecast_error_metrics(+compound,-float,-float) - one_or_error
Exceptions:
The scored count is a variable:
instantiation_error
The scored count is not an integer:
type_error(integer,Count)
The scored count is not positive:
domain_error(positive_integer,Count)
Metric arithmetic raises an evaluation error:
evaluation_error(Error)

mean_absolute_error/3

Computes the mean absolute error (MAE) between actual and predicted value lists of matching length.

Compilation flags:
static
Template:
mean_absolute_error(Actual,Predicted,MAE)
Mode and number of proofs:
mean_absolute_error(+list(number),+list(number),-float) - one_or_error
Exceptions:
An input series is empty:
domain_error(non_empty_series,Series)
The actual and predicted series have different lengths:
consistency_error(same_length,Actual,Predicted)

root_mean_squared_error/3

Computes the root mean squared error (RMSE) between actual and predicted value lists of matching length.

Compilation flags:
static
Template:
root_mean_squared_error(Actual,Predicted,RMSE)
Mode and number of proofs:
root_mean_squared_error(+list(number),+list(number),-float) - one_or_error
Exceptions:
An input series is empty:
domain_error(non_empty_series,Series)
The actual and predicted series have different lengths:
consistency_error(same_length,Actual,Predicted)

mean_absolute_percentage_error/3

Computes the mean absolute percentage error (MAPE), as a percentage, between actual and predicted value lists of matching length.

Compilation flags:
static
Template:
mean_absolute_percentage_error(Actual,Predicted,MAPE)
Mode and number of proofs:
mean_absolute_percentage_error(+list(number),+list(number),-float) - one_or_error
Exceptions:
An input series is empty:
domain_error(non_empty_series,Series)
The actual and predicted series have different lengths:
consistency_error(same_length,Actual,Predicted)
An actual value is zero:
evaluation_error(zero_divisor)

naive_forecast/3

Repeats the last observed series value Horizon times (the naive/persistence baseline forecast). A zero horizon returns an empty list.

Compilation flags:
static
Template:
naive_forecast(Series,Horizon,Forecasts)
Mode and number of proofs:
naive_forecast(+list(number),+non_negative_integer,-list(number)) - one_or_error
Exceptions:
Horizon is a variable:
instantiation_error
Horizon is neither a variable nor an integer:
type_error(integer,Horizon)
Horizon is an integer but is negative:
domain_error(non_negative_integer,Horizon)

constant_forecast/3

Repeats a value for the given forecast horizon. A zero horizon returns an empty list.

Compilation flags:
static
Template:
constant_forecast(Value,Horizon,Forecasts)
Mode and number of proofs:
constant_forecast(+number,+non_negative_integer,-list(number)) - one_or_error
Exceptions:
Horizon is a variable:
instantiation_error
Horizon is neither a variable nor an integer:
type_error(integer,Horizon)
Horizon is an integer but is negative:
domain_error(non_negative_integer,Horizon)

linear_trend_forecast/4

Forecasts Last + Step * Slope for steps one through the horizon. A zero horizon returns an empty list.

Compilation flags:
static
Template:
linear_trend_forecast(Last,Slope,Horizon,Forecasts)
Mode and number of proofs:
linear_trend_forecast(+number,+number,+non_negative_integer,-list(number)) - one_or_error
Exceptions:
Horizon, Last, or Slope is a variable:
instantiation_error
Horizon is neither a variable nor an integer:
type_error(integer,Horizon)
Horizon is an integer but is negative:
domain_error(non_negative_integer,Horizon)
Last is neither a variable nor a number:
type_error(number,Last)
Slope is neither a variable nor a number:
type_error(number,Slope)
Trend extrapolation raises an arithmetic evaluation error:
evaluation_error(Error)

check_forecast_horizon/1

Checks that a forecast horizon is a non-negative integer.

Compilation flags:
static
Template:
check_forecast_horizon(Horizon)
Mode and number of proofs:
check_forecast_horizon(+non_negative_integer) - one_or_error
Exceptions:
Horizon is a variable:
instantiation_error
Horizon is neither a variable nor an integer:
type_error(integer,Horizon)
Horizon is an integer but is negative:
domain_error(non_negative_integer,Horizon)

seasonal_naive_forecast/4

Repeats the last full seasonal cycle of Frequency observations, cycling as needed to cover Horizon forecasts (the seasonal naive baseline forecast).

Compilation flags:
static
Template:
seasonal_naive_forecast(Series,Frequency,Horizon,Forecasts)
Mode and number of proofs:
seasonal_naive_forecast(+list(number),+positive_integer,+non_negative_integer,-list(number)) - one_or_error
Exceptions:
Frequency is a variable:
instantiation_error
Frequency is neither a variable nor an integer:
type_error(integer,Frequency)
Frequency is an integer but is not positive:
domain_error(positive_integer,Frequency)
Horizon is a variable:
instantiation_error
Horizon is neither a variable nor an integer:
type_error(integer,Horizon)
Horizon is an integer but is negative:
domain_error(non_negative_integer,Horizon)
Series has fewer than Frequency observations:
domain_error(series_length,Series)

check_frequency/1

Checks that a seasonal frequency is a positive integer.

Compilation flags:
static
Template:
check_frequency(Frequency)
Mode and number of proofs:
check_frequency(+positive_integer) - one_or_error
Exceptions:
Frequency is a variable:
instantiation_error
Frequency is neither a variable nor an integer:
type_error(integer,Frequency)
Frequency is an integer but is not positive:
domain_error(positive_integer,Frequency)

seasonal_autocorrelation_test/4

Tests original-lag available-pair autocorrelations using the known observation count and requiring two known pairs at every tested lag.

Compilation flags:
static
Template:
seasonal_autocorrelation_test(Series,Frequency,Statistic,Seasonal)
Mode and number of proofs:
seasonal_autocorrelation_test(+list,+positive_integer,-number,-boolean) - one_or_error
Exceptions:
The series or frequency is unbound:
instantiation_error
A series value is not numeric:
type_error(number,Value)
The series is not a list:
type_error(list,Series)
The series is empty:
domain_error(non_empty_series,Series)
The frequency is not an integer:
type_error(integer,Frequency)
The frequency is not positive:
domain_error(positive_integer,Frequency)
Seasonality test arithmetic fails:
evaluation_error(Error)

classical_seasonal_adjustment/5

Deseasonalizes known values using complete centered windows and normalized phase factors, preserving missing observations as unbound variables.

Compilation flags:
static
Template:
classical_seasonal_adjustment(Series,Frequency,Method,AdjustedSeries,Factors)
Mode and number of proofs:
classical_seasonal_adjustment(+list,+positive_integer,+atom,-list,-list(number)) - one_or_error
Exceptions:
The series, frequency, or method is unbound:
instantiation_error
A value is not numeric:
type_error(number,Value)
The series is not a list:
type_error(list,Series)
The series is empty:
domain_error(non_empty_series,Series)
The frequency is not an integer:
type_error(integer,Frequency)
The frequency is not positive:
domain_error(positive_integer,Frequency)
The frequency is less than two:
domain_error(seasonal_frequency,Frequency)
The series has fewer than two cycles:
domain_error(series_length,Series)
The method is invalid:
domain_error(seasonal_adjustment_method,Method)
A phase has no valid centered-window deviation:
domain_error(insufficient_seasonal_phase_observations,Phase)
Multiplicative data or factors are not positive:
domain_error(positive_number,Value)
Seasonal adjustment arithmetic fails:
evaluation_error(Error)

restore_seasonality/5

Adds or multiplies a seasonal cycle, advancing phase through missing positions without instantiating them.

Compilation flags:
static
Template:
restore_seasonality(Method,Factors,StartPhase,Values,RestoredValues)
Mode and number of proofs:
restore_seasonality(+atom,+list(number),+positive_integer,+list,-list) - one_or_error
Exceptions:
The method, phase, factor, or values list is unbound:
instantiation_error
A factor or value is not numeric:
type_error(number,Value)
Factors or values are not lists:
type_error(list,List)
The factors are empty:
domain_error(non_empty_series,Factors)
The method is invalid:
domain_error(seasonal_adjustment_method,Method)
The phase is not an integer:
type_error(integer,StartPhase)
The phase is not positive:
domain_error(positive_integer,StartPhase)
The phase exceeds the cycle length:
domain_error(seasonal_phase,StartPhase)
A multiplicative factor is not positive:
domain_error(positive_number,Value)
Restoration arithmetic fails:
evaluation_error(Error)

Private predicates

sorted_observations/5

Validates sorted indices without binding them while collecting values and counting observations.

Compilation flags:
static
Template:
sorted_observations(Pairs,Dataset,ExpectedIndex,Length,Series)
Mode and number of proofs:
sorted_observations(@list(pair),+object_identifier,+positive_integer,-non_negative_integer,-list) - one_or_error
Exceptions:
An observation index is a variable:
instantiation_error
The observation indices are not a gap-free 1-based integer sequence:
domain_error(series_index_sequence,Dataset)
Index arithmetic raises an evaluation error:
evaluation_error(Error)

normalize_missing_values/4

Copies known numbers and replaces unbound inputs with a fresh shared variable.

Compilation flags:
static
Template:
normalize_missing_values(Series,Missing,Context,Normalized)
Mode and number of proofs:
normalize_missing_values(+list,-term,+term,-list) - one_or_error
Exceptions:
A known observation is not numeric:
type_error(number,Value)

indexed_known_values/5

Extracts known observations while retaining elapsed positions.

Compilation flags:
static
Template:
indexed_known_values(Series,Index,Context,Indices,Values)
Mode and number of proofs:
indexed_known_values(+list,+positive_integer,+term,-list,-list) - one_or_error
Exceptions:
A known value is not numeric:
type_error(number,Value)
Index arithmetic fails:
evaluation_error(Error)

check_numeric_residuals/2

Checks residual numbers without completing lists or binding entries.

Compilation flags:
static
Template:
check_numeric_residuals(Residuals,Context)
Mode and number of proofs:
check_numeric_residuals(+list,+term) - one_or_error
Exceptions:
A residual is unbound:
instantiation_error
A residual is not numeric:
type_error(number,Value)

aligned_residual_fits/5

Consumes residuals only at known positions after the initialization anchor, failing on a count mismatch.

Compilation flags:
static
Template:
aligned_residual_fits(Series,Residuals,AnchorSeen,Context,Values)
Mode and number of proofs:
aligned_residual_fits(+list,+list(number),+boolean,+term,-list) - zero_or_one_or_error
Exceptions:
A known observation is not numeric:
type_error(number,Value)
Fit reconstruction arithmetic fails:
evaluation_error(Error)

valid_residual_positions/3

Checks original residual positions in strict chronological order within the elapsed length.

Compilation flags:
static
Template:
valid_residual_positions(Indices,Previous,Length)
Mode and number of proofs:
valid_residual_positions(+list(integer),+integer,+positive_integer) - zero_or_one_or_error
Exceptions:
Index comparison fails:
evaluation_error(Error)

seasonal_centered_values/5

Centers validated observations and accumulates squared deviations.

Compilation flags:
static
Template:
seasonal_centered_values(Series,Mean,Centered,Variance0,Variance)
Mode and number of proofs:
seasonal_centered_values(+list(number),+number,-list(number),+number,-number) - one_or_error
Exceptions:
Centering arithmetic fails:
evaluation_error(Error)

seasonal_lag_scores/7

Accumulates earlier squared autocorrelations and the seasonal-lag score.

Compilation flags:
static
Template:
seasonal_lag_scores(Lag,Frequency,Centered,Variance,Squares0,Squares,Last)
Mode and number of proofs:
seasonal_lag_scores(+positive_integer,+positive_integer,+list(number),+number,+number,-number,-number) - one_or_error
Exceptions:
Autocorrelation arithmetic fails:
evaluation_error(Error)

seasonal_covariance/4

Accumulates products of aligned centered observations.

Compilation flags:
static
Template:
seasonal_covariance(Suffix,Series,Covariance0,Covariance)
Mode and number of proofs:
seasonal_covariance(+list(number),+list(number),+number,-number) - one_or_error
Exceptions:
Covariance arithmetic fails:
evaluation_error(Error)

seasonal_check_method/1

Checks the seasonal adjustment method without binding it.

Compilation flags:
static
Template:
seasonal_check_method(Method)
Mode and number of proofs:
seasonal_check_method(@term) - one_or_error
Exceptions:
The method is unbound:
instantiation_error
The method is invalid:
domain_error(seasonal_adjustment_method,Method)

seasonal_positive_values/1

Requires strictly positive validated numeric values.

Compilation flags:
static
Template:
seasonal_positive_values(Values)
Mode and number of proofs:
seasonal_positive_values(+list(number)) - one_or_error
Exceptions:
A value is not positive:
domain_error(positive_number,Value)
Numeric comparison fails:
evaluation_error(Error)

seasonal_window_means/5

Computes successive moving averages with a rolling sum.

Compilation flags:
static
Template:
seasonal_window_means(Entering,Leaving,Frequency,Sum,Means)
Mode and number of proofs:
seasonal_window_means(+list(number),+list(number),+positive_integer,+number,-list(number)) - one_or_error
Exceptions:
Moving-average arithmetic fails:
evaluation_error(Error)

seasonal_center_even/2

Centers even-period moving averages using adjacent means.

Compilation flags:
static
Template:
seasonal_center_even(Means,Centered)
Mode and number of proofs:
seasonal_center_even(+list(number),-list(number)) - one_or_error
Exceptions:
Centering arithmetic fails:
evaluation_error(Error)

seasonal_deviations/4

Computes interior differences or ratios against centered trend estimates.

Compilation flags:
static
Template:
seasonal_deviations(Trends,Values,Method,Deviations)
Mode and number of proofs:
seasonal_deviations(+list(number),+list(number),+atom,-list(number)) - one_or_error
Exceptions:
A multiplicative trend is not positive:
domain_error(positive_number,Value)
Detrending arithmetic fails:
evaluation_error(Error)

seasonal_fold_cycles/3

Accumulates complete and partial cycles into phase buckets.

Compilation flags:
static
Template:
seasonal_fold_cycles(Values,Buckets0,Buckets)
Mode and number of proofs:
seasonal_fold_cycles(+list,+list(compound),-list(compound)) - one_or_error
Exceptions:
Phase accumulation fails:
evaluation_error(Error)

seasonal_bucket_means/2

Computes phase means from nonempty phase totals.

Compilation flags:
static
Template:
seasonal_bucket_means(Buckets,Means)
Mode and number of proofs:
seasonal_bucket_means(+list(compound),-list(number)) - one_or_error
Exceptions:
Phase-mean arithmetic fails:
evaluation_error(Error)

seasonal_normalize/4

Normalizes phase factors to zero or unit mean.

Compilation flags:
static
Template:
seasonal_normalize(Values,Method,Mean,Factors)
Mode and number of proofs:
seasonal_normalize(+list(number),+atom,+number,-list(number)) - one_or_error
Exceptions:
A multiplicative factor is not positive:
domain_error(positive_number,Value)
Normalization arithmetic fails:
evaluation_error(Error)

seasonal_inverse_factors/3

Negates additive factors or reciprocates positive multiplicative factors.

Compilation flags:
static
Template:
seasonal_inverse_factors(Factors,Method,Inverses)
Mode and number of proofs:
seasonal_inverse_factors(+list(number),+atom,-list(number)) - one_or_error
Exceptions:
Factor inversion fails:
evaluation_error(Error)

seasonal_restore_values/5

Restores validated values while cycling through phase factors.

Compilation flags:
static
Template:
seasonal_restore_values(Values,Method,Factors,Cycle,Restored)
Mode and number of proofs:
seasonal_restore_values(+list,+atom,+list(number),+list(number),-list) - one_or_error
Exceptions:
Restoration arithmetic fails:
evaluation_error(Error)

seasonal_complete_autocorrelation_test/4

Computes the original complete-data seasonality statistic for validated inputs.

Compilation flags:
static
Template:
seasonal_complete_autocorrelation_test(Series,Frequency,Statistic,Seasonal)
Mode and number of proofs:
seasonal_complete_autocorrelation_test(+list(number),+positive_integer,-number,-boolean) - one_or_error
Exceptions:
Autocorrelation arithmetic fails:
evaluation_error(Error)

classical_complete_seasonal_adjustment/5

Computes classical seasonal factors for validated complete data.

Compilation flags:
static
Template:
classical_complete_seasonal_adjustment(Series,Frequency,Method,Adjusted,Factors)
Mode and number of proofs:
classical_complete_seasonal_adjustment(+list(number),+positive_integer,+atom,-list(number),-list(number)) - one_or_error
Exceptions:
Multiplicative data, trends, or factors are not positive:
domain_error(positive_number,Value)
Seasonal arithmetic fails:
evaluation_error(Error)

seasonal_gap_centered/4

Centers known values without removing gaps.

Compilation flags:
static
Template:
seasonal_gap_centered(Series,Mean,Centered,Variance)
Mode and number of proofs:
seasonal_gap_centered(+list,+number,-list,-number) - one_or_error
Exceptions:
Centering arithmetic fails:
evaluation_error(Error)

seasonal_gap_lags/7

Accumulates original-lag scores, failing when fewer than two pairs are available.

Compilation flags:
static
Template:
seasonal_gap_lags(Lag,Frequency,Centered,Variance,Squares0,Squares,Last)
Mode and number of proofs:
seasonal_gap_lags(+positive_integer,+positive_integer,+list,+number,+number,-number,-number) - zero_or_one_or_error
Exceptions:
Autocorrelation arithmetic fails:
evaluation_error(Error)

seasonal_gap_covariance/4

Sums centered products and counts pairs with both positions known.

Compilation flags:
static
Template:
seasonal_gap_covariance(Suffix,Series,Covariance,Pairs)
Mode and number of proofs:
seasonal_gap_covariance(+list,+list,-number,-non_negative_integer) - one_or_error
Exceptions:
Covariance arithmetic fails:
evaluation_error(Error)

seasonal_gap_windows/5

Computes moving averages with rolling sums and missing counts, marking incomplete windows.

Compilation flags:
static
Template:
seasonal_gap_windows(Entering,Leaving,Frequency,Window,Means)
Mode and number of proofs:
seasonal_gap_windows(+list,+list,+positive_integer,+compound,-list) - one_or_error
Exceptions:
Moving-average arithmetic fails:
evaluation_error(Error)

seasonal_gap_even/2

Centers adjacent complete windows, requiring the full even-period support.

Compilation flags:
static
Template:
seasonal_gap_even(Means,Trends)
Mode and number of proofs:
seasonal_gap_even(+list,-list) - one_or_error
Exceptions:
Centering arithmetic fails:
evaluation_error(Error)

seasonal_gap_deviations/4

Computes only known deviations with complete trend support, retaining phase positions.

Compilation flags:
static
Template:
seasonal_gap_deviations(Trends,Values,Method,Deviations)
Mode and number of proofs:
seasonal_gap_deviations(+list,+list,+atom,-list) - one_or_error
Exceptions:
A multiplicative trend is not positive:
domain_error(positive_number,Value)
Detrending arithmetic fails:
evaluation_error(Error)

seasonal_accumulate_cycle/4

Advances a phase bucket for every position, skipping missing contributions.

Compilation flags:
static
Template:
seasonal_accumulate_cycle(Values,Buckets,Updated,Rest)
Mode and number of proofs:
seasonal_accumulate_cycle(+list,+list(compound),-list(compound),-list) - one_or_error
Exceptions:
Phase accumulation fails:
evaluation_error(Error)

seasonal_check_buckets/2

Reports the lowest absolute phase lacking an estimable seasonal deviation.

Compilation flags:
static
Template:
seasonal_check_buckets(Buckets,Phase)
Mode and number of proofs:
seasonal_check_buckets(+list(compound),+positive_integer) - one_or_error
Exceptions:
A phase has no valid deviation:
domain_error(insufficient_seasonal_phase_observations,Phase)
Phase arithmetic fails:
evaluation_error(Error)

Operators

(none)