Skip to content
Back to skills

Mmm Multi Geo Panel

ASecurity

Multi-geo panel MMM using pymc-marketing's multidimensional API. Use when the dataset has multiple geographies, DMAs, countries, or regions that should be modeled together. Covers geo column setup, panel data validation, and the multidimensional MMM constructor.

  • 5 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added May 26, 2026
datapythonapi

Works with

  • api

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add Yakoub-ai/agent-mmm --skill mmm-multi-geo-panel --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mmm Multi Geo Panel?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mmm Multi Geo Panel
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yakoub-ai-mmm-multi-geo-panel/badge)](https://www.skillsdirectory.com/skills/yakoub-ai-mmm-multi-geo-panel)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mmm-multi-geo-panel
description: |
  Multi-geo panel MMM using pymc-marketing's multidimensional API. Use when the dataset has multiple geographies, DMAs, countries, or regions that should be modeled together. Covers geo column setup, panel data validation, and the multidimensional MMM constructor.
---

# Multi-Geo Panel MMM

## When to Use

Use multi-geo panel modeling when:
- You have weekly marketing data for multiple regions, countries, or DMAs
- Channels are bought nationally but results vary by geo
- You want partial-pooling of effects across geos (shrink toward national mean)

**Do not use** for daily data or monthly data in v1 (weekly only).

## Data Format

Panel data must be in long format:

```
date        | geo    | spend_sem | spend_tv | target
2024-01-01  | UK     | 10000     | 50000    | 1200
2024-01-01  | DE     | 8000      | 40000    | 900
2024-01-08  | UK     | 11000     | 52000    | 1250
...
```

- One row per (date × geo) combination
- Date column: weekly periods
- Geo column: string identifier (country code, DMA code, region name)
- All numeric columns in original units (not pre-normalized)

## Spec Configuration

```yaml
geo_column: "geo"  # name of the geo column; null for single-geo
```

When `geo_column` is set, the framework:
1. Validates panel completeness (every geo should have data for every week)
2. Checks for geo-specific missing patterns (some geos inactive for certain channels)
3. Applies VIF checks within each geo before pooling

## Multi-Geo MMM Constructor

```python
from pymc_marketing.mmm.multidimensional import MMM

# For panel data, pass the geo column — the multidimensional MMM handles pooling
model = MMM(
    date_column="date",
    channel_columns=channel_cols,
    target_column="y",
    adstock=GeometricAdstock(l_max=5),
    saturation=LogisticSaturation(),
    control_columns=control_cols,
    yearly_seasonality=8,
    model_config=model_config,
    # geo_column handled via X DataFrame structure — include geo as a coordinate
)
```

**Note**: The multidimensional API infers geo dimensions from the DataFrame coordinates. Ensure the DataFrame index includes (date, geo) if multi-geo.

## Panel Validation Checks

The data audit (`run_audit`) performs these extra checks for multi-geo data:

1. **Completeness**: All geos present for all dates? Missing (date, geo) combinations → FAIL
2. **Geo count**: At least 3 geos recommended for meaningful partial-pooling
3. **Balanced panel**: Geos should have similar number of active observations
4. **Geo-level VIF**: Collinearity checked per-geo, not just overall

## Prior Specification for Multi-Geo

Priors in `model_config` apply globally. If channel effectiveness varies substantially by geo (e.g., TV works in Germany but not UK), consider:
1. Running separate single-geo models (simpler, more interpretable)
2. Widening the prior for the affected channel to let the data determine geo-specific effects

## Data Audit Multi-Geo Output

`audit.json` includes a `multi_geo` section:
```json
{
  "multi_geo": {
    "geo_count": 4,
    "geos": ["UK", "DE", "FR", "NL"],
    "panel_complete": true,
    "missing_cells": 0,
    "per_geo_row_counts": {"UK": 104, "DE": 104, "FR": 104, "NL": 104}
  }
}
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.