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
-------  ----------  -----------  ------  ------  ------  -------  -------  -----  -----------
748.42   2026-10-22  133.13       344.18  517.95  722.45  928.99   1352.56  +0.9%  1790.58
752.64   2026-10-23  137.34       348.40  522.17  719.45  962.35   1418.53         1794.79
757.02   2026-10-24  141.73       352.78  526.55  762.98  1033.22  1476.87         1799.18
761.55   2026-10-25  146.25       357.31  531.08  778.46  1091.82  1510.62         1803.70
766.20   2026-10-26  28.93        28.93   535.73  840.67  1175.39  1669.55         1808.36
770.97   2026-10-27  33.70        33.70   540.50  833.96  1185.89  1722.57         1813.13
775.85   2026-10-28  38.58        38.58   545.37  864.43  1190.76  1803.12         1818
Real output · p202 1.9.78 · demo dataexit 0

Forecast revenue, p10 to p90

  1. 10-22
  2. 10-23
  3. 10-24
  4. 10-25
  5. 10-26
  6. 10-27
  7. 10-28

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
-------  ----------  -----------  ------  ------  ------  -------  -------  -----  -----------
687.55   2026-10-22  160.48       331.83  435.90  619.23  850.98   1310.04  +4.6%  1787.15
688.21   2026-10-23  161.14       260.05  428.02  571.55  917.27   1352.97         1787.82
688.81   2026-10-24  161.74       260.65  426.95  570.26  968.46   1388.19         1788.41
689.35   2026-10-25  162.28       261.19  427.48  654.58  1013.23  1401.94         1788.95
689.83   2026-10-26  148.57       261.67  427.97  654.21  1023.23  1402.43         1789.44
690.27   2026-10-27  149.01       261.18  428.41  691.64  1063.39  1773.62         1789.87
690.66   2026-10-28  149.40       246.84  428.80  789.75  1063.78  1774.01         1790.27
691.01   2026-10-29  149.75       160.36  424.95  681.41  1064.13  1774.36         1790.62
691.33   2026-10-30  61.13        61.13   414.16  692.31  1064.45  1774.68         1790.94
691.62   2026-10-31  61.42        61.42   371.87  771     1351.88  1774.97         1791.22
691.88   2026-11-01  61.67        61.67   372.13  841.16  1352.14  1775.23         1791.48
692.11   2026-11-02  61.90        61.90   372.36  877.03  1352.37  1775.46         1791.71
692.32   2026-11-03  62.11        62.11   372.57  848.78  1352.58  1775.67         1791.92
692.50   2026-11-04  24.96        24.96   320.39  820.77  1352.77  1775.85         1792.11
Real output · p202 1.9.78 · 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, 6 no Pro licence on the install.
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
    }
  ]
}