p202 forecast

Forecast future performance metrics using historical data

Aliaspredict
All commands

01Run it

Straight from the command's own help.

p202 forecast --metric revenue --horizon 7
p202 forecast --metric clicks --history last90 --method linear
p202 forecast --metric profit --horizon 14 --method auto --seasonal
p202 forecast --all-metrics --horizon 7

02What you get

Captured from the real binary, run against a demo store with 30 days of traffic. Switch tabs to see the same run as JSON, the shape scripts and agents parse.

p202 forecast --metric total_income --interval day --horizon 7
$ p202 forecast --metric total_income --interval day --horizon 7
Revenue  date        lower_bound  p10  p25     p50     p75      p90      trend  upper_bound
-------  ----------  -----------  ---  ------  ------  -------  -------  -----  -----------
566.44   2026-10-10  0            0    141.35  461.83  900.04   1271.80  +0.1%  1646.30
566.76   2026-10-11  0            0    141.67  527.67  900.36   1306.08         1646.62
567.18   2026-10-12  0            0    0       591     997.38   1306.50         1647.04
567.69   2026-10-13  0            0    0       499.52  1055.71  1446.37         1647.55
568.27   2026-10-14  0            0    0       491.55  1056.29  1446.95         1648.13
568.92   2026-10-15  0            0    0       552.97  1258.50  1447.61         1648.78
569.63   2026-10-16  0            0    0       274.18  1259.21  1448.31         1649.49
Real output · p202 1.9.77 · demo dataexit 0

Forecast revenue, p10 to p90

  1. 10-10
  2. 10-11
  3. 10-12
  4. 10-13
  5. 10-14
  6. 10-15
  7. 10-16

The band is the 80% range (p10 to p90); the mark is the median. Drawn from the JSON output above.

p202 forecast --metric total_income --interval day --horizon 14 --seasonal
$ p202 forecast --metric total_income --interval day --horizon 14 --seasonal
Revenue  date        lower_bound  p10  p25     p50     p75      p90      trend  upper_bound
-------  ----------  -----------  ---  ------  ------  -------  -------  -----  -----------
540.06   2026-10-10  0            0    133.38  511.52  881.14   1184.39  +1.0%  1590.05
540.14   2026-10-11  0            0    133.47  537.63  1098.02  1184.47         1590.14
540.21   2026-10-12  0            0    126.11  550.14  1098.09  1184.54         1590.21
540.27   2026-10-13  0            0    126.17  515.99  1098.15  1184.60         1590.26
540.32   2026-10-14  0            0    126.22  749.03  1098.20  1185.42         1590.31
540.36   2026-10-15  0            0    92.83   601.14  1162.67  1349.18         1590.36
540.40   2026-10-16  0            0    64.80   555.58  1162.71  1349.22         1590.39
540.43   2026-10-17  0            0    64.83   671.15  1162.74  1449.56         1590.42
540.45   2026-10-18  0            0    64.86   419.43  1162.76  1551.51         1590.45
540.48   2026-10-19  0            0    64.88   635.72  1162.79  1551.54         1590.47
540.50   2026-10-20  0            0    64.90   701.61  1162.81  1551.56         1590.49
540.51   2026-10-21  0            0    64.92   589.01  1186.08  1551.57         1590.51
540.53   2026-10-22  0            0    64.93   511.74  1186.09  1648.39         1648.39
540.54   2026-10-23  0            0    64.94   513.11  1445.95  1648.40         1648.40
Real output · p202 1.9.77 · demo dataexit 0

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 forecast

Set flags below; the command updates as you type.

04Flags

24 flags, plus the global flags every command takes.

FlagWhat it does
--aff-campaign-idstringFilter by campaign ID
--aff-network-idstringFilter by affiliate network ID
--all-metricsboolForecast clicks, leads, income, cost, and net together via ratio decomposition (coherent output)
--anomaly-cyclesint · default 4Seasonal cycles on each side used as same-weekday/hour references for transient masking
--anomaly-sigmafloat64 · default 5Transient-masking threshold in robust sigma units (lower masks more aggressively)
--confidencefloat64 · default 0.95Confidence level for prediction bounds; snaps to the nearest band: 0.50 (p25-p75), 0.80 (p10-p90), or 0.90 (p05-p95, also used for 0.95/0.99)
--country-idstringFilter by country ID
--daysstringAlias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime
todayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime
--event-tagstringFilter forecast events by tag (comma-separated, e.g. us-holidays,promos)
--eventsboolEnable event-aware forecasting using stored forecast events
--historystring · default last90Historical data period (aliases: --period, --days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime
todayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime
--horizon, -nint · default 7Number of periods to forecast forward
--interval, -istring · default dayForecast granularity: hour, day, week, month
hourdayweekmonth
--landing-page-idstringFilter by landing page ID
--methodstring · default autoForecasting method (auto = ensemble): linear, sma, wma, holtwinters, ensemble, auto
linearsmawmaholtwintersensembleauto
--metric, -mstringMetric to forecast: total_clicks, total_click_throughs, total_leads, total_income, total_cost, total_net, epc, avg_cpc, conv_rate, roi, cpa (aliases: clicks=total_clicks, conversions=total_leads, cost=total_cost, income=total_income, leads=total_leads, net=total_net, profit=total_net, revenue=total_income)
total_clickstotal_click_throughstotal_leadstotal_incometotal_costtotal_netepcavg_cpcconv_rateroicpaclicks → total_clicksconversions → total_leadscost → total_costincome → total_incomeleads → total_leadsnet → total_netprofit → total_netrevenue → total_income
--no-anomaly-maskboolDisable transient masking (fit short outlier runs such as tracking outages as data)
--no-level-shiftboolDisable level-shift detection (fit the full history as-is)
--periodstringAlias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime
todayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime
--ppc-account-idstringFilter by PPC account ID
--ppc-network-idstringFilter by PPC network ID
--seasonalboolApply a day-of-week profile learned from the fetched history (hour interval also gets an hour-of-day profile)
--seasonal-monthlyboolApply day-of-month seasonal adjustment learned from the fetched series (requires --interval day)
--windowintSMA/WMA window size (0 = auto-select)

05How it works

Forecast future values for any tracked metric using statistical methods.

Fetches historical time-series data from your Prosper202 instance and projects it forward using the selected algorithm. Supports linear regression, simple and weighted moving averages, damped-trend Holt-Winters exponential smoothing, and an ensemble (the default, alias "auto") that combines the methods weighted by rolling-backtest accuracy and reports each member's share.

With --seasonal, predictions are modulated by a day-of-week profile learned from the fetched history itself (re-estimated inside every backtest fold, so the bands describe the profiled forecast) to account for weekly patterns (e.g., "Tuesdays always convert better"). Requires --interval day or hour.

Event-aware forecasting (--events, --event-tag) uses stored calendar events and requires --interval day.

Derived metrics (leads, income, cost, net) requested without --seasonal or --events are composed from driver forecasts (clicks and the linking rates), so leads = clicks x conv_rate, income = leads x avg_payout, and net = income - cost hold exactly; --all-metrics forecasts all core metrics together this way.

Bounds are empirical quantiles from a rolling backtest (meta "bounds" names the pair, e.g. p05-p95 (90%)); short histories fall back to Gaussian bounds (meta "bounds_source"). Short outlier runs such as a tracking outage are masked from fitting and listed in meta "anomalies_masked"; a detected level shift is reported as "level_shift_at" and the new regime is fitted. Use --no-anomaly-mask / --no-level-shift to fit the history exactly as-is.

Examples: p202 forecast --metric revenue --horizon 7 p202 forecast --metric clicks --history last90 --method linear p202 forecast --metric profit --horizon 14 --method auto --seasonal p202 forecast --all-metrics --horizon 7 p202 forecast --metric conv_rate --history last30 --interval week --horizon 4 p202 forecast --metric revenue --aff-campaign-id 5 --horizon 7 p202 forecast --metric revenue --events --horizon 14 p202 forecast --metric clicks --events --event-tag us-holidays p202 forecast --metric clicks --no-anomaly-mask --json

06For agents

Running this from an agent

  • Read the same facts as JSON: p202 commands forecast --json.
  • With AI_AGENT, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
p202 commands forecast --json
{
  "path": "p202 forecast",
  "use": "forecast",
  "short": "Forecast future performance metrics using historical data",
  "long": "Forecast future values for any tracked metric using statistical methods.\n\nFetches historical time-series data from your Prosper202 instance and projects\nit forward using the selected algorithm. Supports linear regression, simple\nand weighted moving averages, damped-trend Holt-Winters exponential smoothing,\nand an ensemble (the default, alias \"auto\") that combines the methods weighted\nby rolling-backtest accuracy and reports each member's share.\n\nWith --seasonal, predictions are modulated by a day-of-week profile learned\nfrom the fetched history itself (re-estimated inside every backtest fold, so\nthe bands describe the profiled forecast) to account for weekly patterns\n(e.g., \"Tuesdays always convert better\"). Requires --interval day or hour.\n\nEvent-aware forecasting (--events, --event-tag) uses stored calendar events and\nrequires --interval day.\n\nDerived metrics (leads, income, cost, net) requested without --seasonal or\n--events are composed from driver forecasts (clicks and the linking rates),\nso leads = clicks x conv_rate, income = leads x avg_payout, and net =\nincome - cost hold exactly; --all-metrics forecasts all core metrics\ntogether this way.\n\nBounds are empirical quantiles from a rolling backtest (meta \"bounds\" names\nthe pair, e.g. p05-p95 (90%)); short histories fall back to Gaussian bounds\n(meta \"bounds_source\"). Short outlier runs such as a tracking outage are\nmasked from fitting and listed in meta \"anomalies_masked\"; a detected level\nshift is reported as \"level_shift_at\" and the new regime is fitted. Use\n--no-anomaly-mask / --no-level-shift to fit the history exactly as-is.\n\nExamples:\n  p202 forecast --metric revenue --horizon 7\n  p202 forecast --metric clicks --history last90 --method linear\n  p202 forecast --metric profit --horizon 14 --method auto --seasonal\n  p202 forecast --all-metrics --horizon 7\n  p202 forecast --metric conv_rate --history last30 --interval week --horizon 4\n  p202 forecast --metric revenue --aff-campaign-id 5 --horizon 7\n  p202 forecast --metric revenue --events --horizon 14\n  p202 forecast --metric clicks --events --event-tag us-holidays\n  p202 forecast --metric clicks --no-anomaly-mask --json",
  "aliases": [
    "predict"
  ],
  "runnable": true,
  "flags": [
    {
      "name": "aff-campaign-id",
      "type": "string",
      "default": "",
      "usage": "Filter by campaign ID",
      "required": false
    },
    {
      "name": "aff-network-id",
      "type": "string",
      "default": "",
      "usage": "Filter by affiliate network ID",
      "required": false
    },
    {
      "name": "all-metrics",
      "type": "bool",
      "default": "false",
      "usage": "Forecast clicks, leads, income, cost, and net together via ratio decomposition (coherent output)",
      "required": false
    },
    {
      "name": "anomaly-cycles",
      "type": "int",
      "default": "4",
      "usage": "Seasonal cycles on each side used as same-weekday/hour references for transient masking",
      "required": false
    },
    {
      "name": "anomaly-sigma",
      "type": "float64",
      "default": "5",
      "usage": "Transient-masking threshold in robust sigma units (lower masks more aggressively)",
      "required": false
    },
    {
      "name": "confidence",
      "type": "float64",
      "default": "0.95",
      "usage": "Confidence level for prediction bounds; snaps to the nearest band: 0.50 (p25-p75), 0.80 (p10-p90), or 0.90 (p05-p95, also used for 0.95/0.99)",
      "required": false
    },
    {
      "name": "country-id",
      "type": "string",
      "default": "",
      "usage": "Filter by country ID",
      "required": false
    },
    {
      "name": "days",
      "type": "string",
      "default": "",
      "usage": "Alias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
      "allowed_values": [
        "today",
        "yesterday",
        "last7",
        "last14",
        "last30",
        "last90",
        "thismonth",
        "lastmonth",
        "thisyear",
        "lastyear",
        "alltime"
      ],
      "required": false
    },
    {
      "name": "event-tag",
      "type": "string",
      "default": "",
      "usage": "Filter forecast events by tag (comma-separated, e.g. us-holidays,promos)",
      "required": false
    },
    {
      "name": "events",
      "type": "bool",
      "default": "false",
      "usage": "Enable event-aware forecasting using stored forecast events",
      "required": false
    },
    {
      "name": "history",
      "type": "string",
      "default": "last90",
      "usage": "Historical data period (aliases: --period, --days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
      "allowed_values": [
        "today",
        "yesterday",
        "last7",
        "last14",
        "last30",
        "last90",
        "thismonth",
        "lastmonth",
        "thisyear",
        "lastyear",
        "alltime"
      ],
      "required": false
    },
    {
      "name": "horizon",
      "shorthand": "n",
      "type": "int",
      "default": "7",
      "usage": "Number of periods to forecast forward",
      "required": false
    },
    {
      "name": "interval",
      "shorthand": "i",
      "type": "string",
      "default": "day",
      "usage": "Forecast granularity: hour, day, week, month",
      "allowed_values": [
        "hour",
        "day",
        "week",
        "month"
      ],
      "required": false
    },
    {
      "name": "landing-page-id",
      "type": "string",
      "default": "",
      "usage": "Filter by landing page ID",
      "required": false
    },
    {
      "name": "method",
      "type": "string",
      "default": "auto",
      "usage": "Forecasting method (auto = ensemble): linear, sma, wma, holtwinters, ensemble, auto",
      "allowed_values": [
        "linear",
        "sma",
        "wma",
        "holtwinters",
        "ensemble",
        "auto"
      ],
      "required": false
    },
    {
      "name": "metric",
      "shorthand": "m",
      "type": "string",
      "default": "",
      "usage": "Metric to forecast: total_clicks, total_click_throughs, total_leads, total_income, total_cost, total_net, epc, avg_cpc, conv_rate, roi, cpa (aliases: clicks=total_clicks, conversions=total_leads, cost=total_cost, income=total_income, leads=total_leads, net=total_net, profit=total_net, revenue=total_income)",
      "allowed_values": [
        "total_clicks",
        "total_click_throughs",
        "total_leads",
        "total_income",
        "total_cost",
        "total_net",
        "epc",
        "avg_cpc",
        "conv_rate",
        "roi",
        "cpa"
      ],
      "value_aliases": {
        "clicks": "total_clicks",
        "conversions": "total_leads",
        "cost": "total_cost",
        "income": "total_income",
        "leads": "total_leads",
        "net": "total_net",
        "profit": "total_net",
        "revenue": "total_income"
      },
      "required": false
    },
    {
      "name": "no-anomaly-mask",
      "type": "bool",
      "default": "false",
      "usage": "Disable transient masking (fit short outlier runs such as tracking outages as data)",
      "required": false
    },
    {
      "name": "no-level-shift",
      "type": "bool",
      "default": "false",
      "usage": "Disable level-shift detection (fit the full history as-is)",
      "required": false
    },
    {
      "name": "period",
      "type": "string",
      "default": "",
      "usage": "Alias of --history: today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
      "allowed_values": [
        "today",
        "yesterday",
        "last7",
        "last14",
        "last30",
        "last90",
        "thismonth",
        "lastmonth",
        "thisyear",
        "lastyear",
        "alltime"
      ],
      "required": false
    },
    {
      "name": "ppc-account-id",
      "type": "string",
      "default": "",
      "usage": "Filter by PPC account ID",
      "required": false
    },
    {
      "name": "ppc-network-id",
      "type": "string",
      "default": "",
      "usage": "Filter by PPC network ID",
      "required": false
    },
    {
      "name": "seasonal",
      "type": "bool",
      "default": "false",
      "usage": "Apply a day-of-week profile learned from the fetched history (hour interval also gets an hour-of-day profile)",
      "required": false
    },
    {
      "name": "seasonal-monthly",
      "type": "bool",
      "default": "false",
      "usage": "Apply day-of-month seasonal adjustment learned from the fetched series (requires --interval day)",
      "required": false
    },
    {
      "name": "window",
      "type": "int",
      "default": "0",
      "usage": "SMA/WMA window size (0 = auto-select)",
      "required": false
    }
  ]
}