In Marketing Mix Modeling, a common challenge is ensuring the model's results
reflect the complex reality of your business. Meridian addresses this with a
powerful Bayesian feature: **priors**. This page provides a high-level
introduction to what priors are, why they are a cornerstone of Meridian's
methodology, and key considerations for using them.

## What Are Priors?

A "prior" is information you provide to the model *before* it analyzes your
data. Think of it as giving the model a head start or some expert advice based
on your business knowledge, industry benchmarks, or results from past
experiments. This relationship is at the heart of Bayesian statistics and can be
summarized as:

\\\[ \\underset{\\text{(the model)}}{\\text{Posterior}} \\propto \\underset{\\text{(the
data)}}{\\text{Likelihood}} \\cdot \\underset{\\text{(your belief)}}{\\text{Prior}}
\\\]

The model's **posterior** distribution, from which estimates are derived, takes
into consideration both your initial beliefs (the **prior** ) and what the data
itself suggests (the **likelihood**). The prior stabilizes your model while
keeping it grounded in real-world business context.

A key feature of Meridian is its ability to work directly with the business
metrics you care about. Instead of requiring prior information about abstract
regression coefficients, Meridian is structured to incorporate prior information
about tangible and measurable metrics like Return on Investment (ROI), Marginal
Return on Investment (mROI), and contribution percentage.

A **prior** can come from many sources:

- Results from past incrementality experiments (for example, lift tests or geo-experiments).
- Industry benchmarks.
- Previous MMM results.
- Your team's own subject matter expertise.

If you don't have any, don't worry. Meridian has inbuilt defaults which can give
you a jumping off point.

### Understand Priors in terms of Distributions

To gain an intuitive understanding of priors, we present some visual examples
for how you can translate your business intuition into priors for your MMM.

#### What a Prior Distribution Looks Like

Priors are expressed as probability distributions. A distribution assigns a
density (relative likelihood) to every possible value of a parameter, such as
ROI. The **area under the curve** between any two points on the x-axis
represents the probability that the true value falls within that range. For
example, the following distribution plot shows that values between -1 and 1 are
much more likely than values outside that range. For a Normal distribution with
mean = 0 and standard deviation = 1, there is a 68.3% probability that the true
value lies between -1 and 1.

![Normal distribution curve showing 68%, 95%, and 99.7% confidence intervals for
a prior distribution.](https://developers.google.com/static/meridian/images/prior_auc.png)

#### The effect of standard deviation on confidence

The standard deviation controls the width of the distribution and reflects your
**confidence** in the parameter value. A smaller standard deviation concentrates
the probability around the parameter value, indicating higher confidence, while
a larger standard deviation spreads the probability out, indicating more
uncertainty.

![Comparing two prior distributions: a high-confidence prior with small sigma
versus a low-confidence prior with large sigma.](https://developers.google.com/static/meridian/images/prior_comparison.png)

#### Comparison of Common Prior Distributions

While the Normal distribution is a useful illustration, other distributions are
often more suitable depending on the parameter being modeled. For example, since
ROI should be positive, a distribution that only assigns probability to positive
values---like the Log-Normal or Half-Normal---is often a better choice than a Normal
distribution, which allows for negative values. Meridian uses several common
distributions, allowing you to select the one that best reflects the nature of
the parameter you are modeling.

> [!NOTE]
> **Note:** For more details on how to specify prior types for specific treatments, check out [Choose and configure treatment prior
> types](https://developers.google.com/meridian/docs/advanced-modeling/how-to-choose-treatment-prior-types).

![Gallery of common probability distributions including Normal, Log-Normal,
Beta, Half-Normal, Uniform, and Truncated Normal.](https://developers.google.com/static/meridian/images/prior_distributions_comparison.png)

### An Example in Code: Confidence versus Uncertainty

Here's how you might express different levels of belief about the ROI for three
different paid media channels in your code.

    from meridian.model import prior_distribution

    # --- Channel 1: High Confidence ---
    # You have strong experiment results showing ROI is consistently around 1.2.
    # You use a small standard deviation (0.2) to reflect your high confidence.
    strong_prior_channel_1 = prior_distribution.lognormal_dist_from_mean_std(
        mean=1.2,
        std=0.2
    )

    # --- Channel 2: Low Confidence ---
    # You have weaker experiment results showing ROI is around 1.0.
    # You use a larger standard deviation (0.9) to reflect your weaker confidence in
    # the experiment result than for Channel 1.
    weak_prior_channel_2 = prior_distribution.lognormal_dist_from_mean_std(
        mean=1.0,
        std=0.9
    )

    # --- Channel 3: Confidence in a range ---
    # You believe there's a 95% chance the ROI is between 2.0 and 6.0.
    range_prior_channel_3 = prior_distribution.lognormal_dist_from_range(
        low=2.0,
        high=6.0,
        mass_percent=0.95
    )

    # You would then assign these distributions to their respective channels
    # when you configure your model.
    prior_config = prior_distribution.PriorDistribution(
        roi_m=[
            strong_prior_channel_1,
            weak_prior_channel_2,
            range_prior_channel_3,
        ]
    )

> [!NOTE]
> **Note:** [Find out more about how to set up a custom prior based on past
> experiments](https://developers.google.com/meridian/docs/advanced-modeling/set-custom-priors-past-experiments).

#### Visualize Your Priors

Plotting your priors is straightforward and can help ensure that your priors
match your intuition.

    from matplotlib import pyplot as plt
    from meridian.model import prior_distribution
    import numpy as np

    # Define the LogNormal distribution
    lognormal_dist = prior_distribution.lognormal_dist_from_mean_std(2.0, 0.5)
    # Plot a histogram of samples from the LogNormal distribution
    plt.hist(lognormal_dist.sample(1000))

## Why Priors Matter

Using priors is more than just a technical feature; it is fundamental to getting
causal estimates that you can trust and act on.

- **More Plausible and Stable Results with Less Data**: Aggregated marketing data can be sparse or noisy. Priors provide a stabilizing effect, guiding the model toward plausible outcomes and preventing it from reaching incorrect conclusions based on limited data.
- **Results Grounded in Business Reality**: By incorporating knowledge from
  trusted sources like lift studies, the prior's stabilizing effect guides the
  model into alignment with this knowledge, increasing stakeholder confidence.
  You almost always have some intuition about your business. For example, it
  may be rare to get an ROI greater than 6.0 in your industry. You can encode
  this intuition in your prior to guide the model toward more realistic
  results, even if you don't have hard data from an experiment.

- **Intuitive Model Controls**: Meridian offers intuitive ways to set a prior
  -- it's like having a conversation with your model. Instead of tweaking
  abstract parameters, you are providing guidance in a language you
  understand. You can tell the model, "I have strong evidence that the ROI for
  my channel is around 1.5."

### Technical details: priors as regularization

In Meridian, it is helpful to view informative priors as a mathematical form of
regularization. **Regularization** is a technique in statistical modeling that
introduces additional information or constraints to prevent a model from
overfitting to noisy data.

Common regularization methods, such as ridge or LASSO regression, typically
constrain estimates by pulling them toward zero. Meridian's Bayesian framework
offers a more flexible approach by using the prior itself to perform the
regularization. Instead of defaulting to zero, an informative prior regularizes
the model toward a realistic range of values grounded in business knowledge or
historical data.

Relying on the prior to regularize the model is especially important because it
provides a necessary mathematical anchor when your data is limited or lacks a
clear signal. Although it might be tempting to use flat, non-informative priors
for channels with no prior experiments, doing so removes this stabilizing effect
and can lead to high-variance or unreliable estimates. If you don't have past
experiment results or business intuition, start with Meridian's default priors.
These defaults act as sensible starting points that regularize the model
effectively. Finding the ideal degree of regularization is often an iterative
process that involves checking out-of-sample model fit at various regularization
strengths.