New: PyMC-Marketing 0.10 is here with improved MMM capabilities
Tutorials

Introduction to Bayesian Statistics with PyMC

Bayesian statistics provides a powerful framework for reasoning about uncertainty...

Why Bayesian?

Unlike frequentist approaches, Bayesian methods allow us to incorporate prior knowledge...

import pymc as pm

with pm.Model() as model:
    mu = pm.Normal("mu", mu=0, sigma=1)
    obs = pm.Normal("obs", mu=mu, sigma=1, observed=data)

Setting Up Your First Model

Let's walk through building a simple Bayesian linear regression model step by step.

Choosing Priors

The choice of prior distribution encodes your beliefs about the parameter before seeing data.

Posterior distribution plot

Interpreting Results

Once sampling is complete, we examine the posterior distribution to draw inferences about our parameters.

The posterior is proportional to the likelihood times the prior.