Predictive Analytics icon

Predictive Analytics

Run explainable forecasting operations on finance time series without arbitrary formulas.

Simple Linear Regression

AI-generated

Summary

Perform a simple linear regression on a numeric financial time series to forecast future values based on an independent numeric variable.

Inputs

  • currency — Optional currency metadata to include in the predictive result.
  • horizon (required) — Number of future forecast points to generate, must be at least 1.
  • maxHorizon (required) — Recommended maximum forecast horizon; forecast horizons larger than this emit warnings but are allowed.
  • valueColumn (required) — Name of the column in the input data containing the numeric financial series to be forecasted.
  • xColumn (required) — Name of the numeric independent variable column used by the simple linear regression.

Output shape

A single JSON object containing: the original columns used, the currency if specified, the linear regression model parameters (slope, intercept, R²), forecasted values for the specified horizon steps, various forecast metrics (MAE, MSE, RMSE, MAPE), summary text, and warnings or errors encountered.

Input must be an array of JSON objects representing time series rows with numeric columns matching the specified valueColumn and xColumn. The forecast horizon must be >=1; horizons exceeding maxHorizon trigger warnings. The operation returns detailed audit trail events and may emit warnings for small sample sizes, missing or non-numeric data, horizon exceeding history length, and outliers. Errors are returned if required columns are missing or insufficient valid observations exist.

Links

Discussion