BAyesian Model-Building Interface (BAMBI) in Python#
Bambi is a high-level Bayesian model-building interface written in Python. It works with two probabilistic programming frameworks, PyMC3 or PyStan, and is designed to make it extremely easy to fit Bayesian mixed-effects models common in biology, social sciences and other disciplines.
0.1.1 will be the final version supporting Python 2, but look forward to the forthcoming Bambi version
Bambi is tested on Python 2.7 and 3.6 and depends on NumPy, Pandas, PyMC3, PyStan, and Patsy (see requirements.txt for version information).
The latest release of Bambi can be installed using pip:
pip install bambi
Alternatively, if you want the bleeding edge version of the package, you can install from GitHub:
pip install git+https://github.com/bambinos/bambi.git
A simple fixed effects model is shown below as example.
from bambi import Model import pandas as pd # Read in a tab-delimited file containing our data data = pd.read_table('my_data.txt', sep='\t') # Initialize the model model = Model(data) # Fixed effects only model results = model.fit('DV ~ IV1 + IV2', samples=1000, chains=4) # Drop the first 100 burn-in samples from each chain and plot results[100:].plot() # Key summary and diagnostic info on the model parameters results[100:].summary()
For a more in-depth introduction to Bambi see our Quickstart or our set of example notebooks.
We welcome contributions from interested individuals or groups! For information about contributing to Bambi, check out our instructions, policies, and guidelines here.
See the GitHub contributor page.
- Getting Started
- User Guide
- Creating a model
- Model specification
- Fitting the model
- Alternative back-ends
- Specifying priors
- Generalized linear mixed models
- Accessing back-end objects
- Bayesian Logistic Regression Example
- Bayesian/Frequentist Tutorial
- Bayesian Multiple Regression Example
- Bayesian Workflow Example (Police Officer’s Dilemma)
- Bayesian Workflow Example (Strack RRR Analysis Replication)
- API Reference