> For the complete documentation index, see [llms.txt](https://mixmodeler.gitbook.io/mixmodeler-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mixmodeler.gitbook.io/mixmodeler-docs/model-building/variable-testing/granger-causality-tests.md).

# Granger Causality Tests

### What is Granger Causality?

Granger Causality tests whether one time series can predict another. It doesn't prove true causation, but shows if past values of X help forecast Y.

**Key question:** Does knowing X's history improve predictions of Y beyond Y's own history?

**Marketing application:** Does marketing activity predict sales changes, or do they just happen to move together?

### Why Test Granger Causality?

#### Validate Marketing Effectiveness

**Without test:**

* Correlation might be coincidence
* Can't confirm marketing drives sales
* Stakeholder skepticism

**With test:**

* Statistical evidence of predictive relationship
* Confidence marketing influences outcomes
* Stronger business case

#### Detect Reverse Causality

**Possible scenarios:**

* Marketing causes sales ✓
* Sales cause marketing (budget follows performance)
* Both influence each other
* Neither causes the other (coincidence)

**Granger test reveals:** Direction of predictive relationship

#### Improve Variable Selection

**Use to:**

* Validate variable relevance before adding
* Confirm marketing variables predict KPI
* Identify spurious correlations
* Build more credible models

### How Granger Causality Works

#### The Test Logic

**Question:** Does X Granger-cause Y?

**Process:**

1. Predict Y using only Y's past values
2. Predict Y using Y's past + X's past values
3. Compare prediction accuracy
4. If adding X improves predictions significantly → X Granger-causes Y

**Statistical test:** F-test comparing models

**Result:** P-value indicating significance

### Using Granger Causality in MixModeler

#### Location

Variable Testing page → Granger Causality tab

#### Configuration Options

**Test Target:**

* **KPI Testing:** Test if variables predict KPI (recommended for MMM)
* **Between Variables:** Test causality between variables

**Max Lags:**

* Number of past periods to include
* **4 lags (default):** Good for weekly MMM
* **1-52 lags:** Adjustable based on data frequency

**Significance Level:**

* **95% (0.05):** Standard (recommended)
* 90%, 99%, 99.9% also available

**Stationarity Test:**

* **Include:** Run ADF test first (recommended)
* Ensures data suitable for Granger test

#### Step-by-Step Process

**Step 1: Select Model**

Choose existing model with KPI defined

**Step 2: Select Variables**

Check variables to test:

* Marketing channels
* Control variables
* External factors

**Step 3: Configure Settings**

* Target: KPI Testing
* Max Lags: 4 (weekly data)
* Significance: 95%
* Include stationarity: Yes

**Step 4: Run Test**

Click "Test Granger Causality"

**Step 5: Review Results**

Results table shows:

* Variable name
* Optimal lags
* F-statistic
* P-value
* Significance status

### Interpreting Results

#### Results Table

**Columns:**

**Variable:**\
Tested variable name

**Cause → Effect:**\
Shows relationship direction (Variable → KPI)

**Optimal Lags:**\
Best number of past periods (automatically selected)

**F-Statistic:**\
Test statistic value (higher = stronger)

**P-Value:**\
Significance level

* < 0.05: Significant Granger causality
* < 0.01: Strong Granger causality
* > 0.05: No significant causality

**Is Significant:**\
Yes/No indicator

#### What Results Mean

**Significant (p < 0.05):**

✅ Past values of marketing variable help predict KPI\
✅ Evidence of predictive relationship\
✅ Good candidate for model inclusion\
✅ Can defend variable choice statistically

**Not Significant (p > 0.05):**

❌ Marketing doesn't predict KPI changes\
❌ Relationship may be coincidental\
❌ Weaker case for inclusion\
❌ Consider alternative variables

#### Example Results

| Variable       | Optimal Lags | F-Stat | P-Value | Significant |
| -------------- | ------------ | ------ | ------- | ----------- |
| TV\_Spend      | 2            | 8.45   | 0.001   | **Yes**     |
| Digital\_Spend | 1            | 5.21   | 0.008   | **Yes**     |
| Radio\_Spend   | 3            | 2.10   | 0.087   | No          |
| Weather        | 4            | 1.45   | 0.234   | No          |

**Interpretation:**

* TV and Digital show strong Granger causality
* Radio borderline (may still include if theoretically important)
* Weather doesn't predict sales in this case

### Stationarity Testing

#### What is Stationarity?

**Stationary series:**

* Constant mean over time
* Constant variance
* No trends

**Non-stationary series:**

* Trending up or down
* Changing variance
* Violates Granger test assumptions

#### ADF (Augmented Dickey-Fuller) Test

**Tests for stationarity**

**Results:**

* **P-value < 0.05:** Stationary ✓
* **P-value > 0.05:** Non-stationary (trend present)

**If non-stationary:**

* Consider differencing (week-over-week change)
* Add trend variable
* Detrend before testing

#### Why It Matters

**Non-stationary data:**

* Can show spurious Granger causality
* Trends create false relationships
* Must address before relying on results

**Stationary data:**

* More reliable Granger tests
* True relationships detected
* Safer interpretation

### Common Testing Scenarios

#### Scenario 1: Validate Marketing Variables

**Question:** Do our marketing channels predict sales?

**Test:**

* All marketing variables vs KPI
* Look for p < 0.05

**Decision:**

* Include variables with significant causality
* Question variables without causality

#### Scenario 2: New Channel Evaluation

**Question:** Should we model new Radio campaign?

**Test:**

* Radio\_Spend → Sales

**If significant:** Strong case for inclusion\
**If not:** May need more data or channel doesn't drive sales

#### Scenario 3: Resolve Multicollinearity

**Question:** TV\_Spend and TV\_GRPs both predict sales, which to keep?

**Test:**

* Both separately
* Compare F-statistics

**Decision:** Keep variable with stronger Granger causality

#### Scenario 4: Detect Reverse Causality

**Question:** Does marketing drive sales or vice versa?

**Test:**

* Marketing → Sales
* Sales → Marketing

**If only Marketing → Sales:** Marketing drives sales ✓\
**If only Sales → Marketing:** Budget follows performance\
**If both:** Complex bidirectional relationship

### Best Practices

#### When to Use

✅ **Before adding variables:** Validate predictive power\
✅ **Stakeholder skepticism:** Provide statistical evidence\
✅ **Variable selection:** Choose among alternatives\
✅ **Model validation:** Confirm model makes sense

#### When NOT to Use

❌ **Small sample:** Need 30+ observations minimum\
❌ **Obvious relationships:** Don't need test for core channels\
❌ **Real-time decisions:** Test takes time, use judgment\
❌ **Non-time-series:** Data must be time-ordered

#### Configuration Guidelines

**Max Lags:**

* Weekly data: 4-8 lags
* Monthly data: 2-4 lags
* Too many lags: Reduces power
* Too few: Misses relationships

**Significance Level:**

* Use 95% (p < 0.05) as standard
* 99% for stronger evidence
* 90% if exploratory

### Limitations

#### What Granger Causality IS NOT

❌ **Not true causation:** Only predictive relationship\
❌ **Not immediate effect:** Tests lagged relationships\
❌ **Not comprehensive:** Just one piece of evidence\
❌ **Not sufficient alone:** Combine with other tests

#### Considerations

**Can miss:**

* Contemporaneous effects (same period)
* Non-linear relationships
* Complex interactions

**Sensitive to:**

* Lag selection
* Non-stationarity
* Missing data

**Use as:** Supporting evidence, not sole justification

### Troubleshooting

#### All variables show no causality

**Possible causes:**

* Too few lags tested
* Non-stationary data
* Contemporaneous effects (no lag)

**Solutions:**

* Increase max lags
* Check stationarity
* Still include theoretically important variables

#### Stationarity test fails

**All variables non-stationary**

**Solutions:**

* Add trend variable to model
* Use first differences
* Acknowledge limitation in interpretation

#### Test takes very long

**Many variables, many lags**

**Solutions:**

* Test fewer variables
* Reduce max lags
* Test in batches

### Key Takeaways

* Granger Causality tests if past marketing predicts future sales
* P-value < 0.05 indicates significant predictive relationship
* Use to validate variable selection and support business case
* Include stationarity test (ADF) for reliable results
* Not proof of true causation, but strong supporting evidence
* Configure 4 lags for weekly MMM data
* Test marketing variables against KPI (recommended)
* Combine with other validation methods for robust models


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mixmodeler.gitbook.io/mixmodeler-docs/model-building/variable-testing/granger-causality-tests.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
