<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Model Fitting — Abacus Documentation</title>
    <link>/model-fitting/index.html</link>
    <description>This section covers the core fitting workflow for PanelMMM: running MCMC, checking priors before fitting, and saving a fitted model for later reuse.&#xA;Pages Fitting the Model - How fit() works, how sampler settings are applied, and what you get back. Prior Predictive Checks - How to sample and inspect prior predictive draws before fitting. Save and Load - How to persist a fitted model to NetCDF and rebuild PanelMMM from saved InferenceData.</description>
    <generator>Hugo</generator>
    <language>en-gb</language>
    <atom:link href="/model-fitting/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Fitting the Model</title>
      <link>/model-fitting/fitting-the-model/index.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/model-fitting/fitting-the-model/index.html</guid>
      <description>Use this page after you have prepared X and y for PanelMMM. For input requirements, see Data Preparation.&#xA;Basic workflow fit() is the main entry point for posterior sampling.&#xA;import pandas as pd from abacus.mmm import GeometricAdstock, LogisticSaturation from abacus.mmm.panel import PanelMMM dataset = pd.read_csv(&#34;data/demo/timeseries/dataset.csv&#34;) dataset[&#34;date&#34;] = pd.to_datetime(dataset[&#34;date&#34;]) X = dataset.drop(columns=[&#34;revenue&#34;]) y = dataset[&#34;revenue&#34;].rename(&#34;revenue&#34;) mmm = PanelMMM( date_column=&#34;date&#34;, target_column=&#34;revenue&#34;, channel_columns=[ &#34;channel_1&#34;, &#34;channel_2&#34;, &#34;channel_3&#34;, &#34;channel_4&#34;, &#34;channel_5&#34;, &#34;channel_6&#34;, ], yearly_seasonality=2, adstock=GeometricAdstock(l_max=4), saturation=LogisticSaturation(), ) idata = mmm.fit( X, y, draws=500, tune=500, chains=2, cores=2, progressbar=False, random_seed=42, ) fit() returns an arviz.InferenceData object and also stores it on mmm.idata.</description>
    </item>
    <item>
      <title>Prior Predictive Checks</title>
      <link>/model-fitting/prior-predictive-checks/index.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/model-fitting/prior-predictive-checks/index.html</guid>
      <description>Run prior predictive checks before fitting when you want to test whether your configured priors imply plausible target behaviour.&#xA;If you want the econometrics framing for this workflow, see Prior Predictive Checks for Econometricians.&#xA;Sample prior predictive draws Use sample_prior_predictive(...) on PanelMMM:&#xA;prior = mmm.sample_prior_predictive( X=X, y=y, samples=100, random_seed=42, ) In normal PanelMMM use, pass the same X and y structure that you plan to fit.</description>
    </item>
    <item>
      <title>Save and Load</title>
      <link>/model-fitting/save-and-load/index.html</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>/model-fitting/save-and-load/index.html</guid>
      <description>Use save and load when you want to persist a fitted PanelMMM and rebuild it later without redefining the whole model configuration in code.&#xA;Basic round trip The standard workflow is:&#xA;mmm.fit( X, y, draws=500, tune=500, chains=2, progressbar=False, random_seed=42, ) mmm.save(&#34;mmm.nc&#34;) loaded = PanelMMM.load(&#34;mmm.nc&#34;) save() writes the model’s InferenceData to NetCDF. load() reads that file, recreates the PanelMMM configuration from stored metadata, restores loaded.idata, and rebuilds the PyMC graph from the saved training data.</description>
    </item>
  </channel>
</rss>