Tomi Capretto
  • Blog
  • About me

Blog

Do rookies get better with each throw? Playing Bayes with NBA free throw data

Sep 25, 2025
If you had to bet against a free throw, would you bet against the first or the second attempt? What if the player were a rookie? And what if it were a specific rookie? Let's try to find out.
Do rookies get better with each throw? Playing Bayes with NBA free throw data

In search of the best thermos for mate with Thomas Bayes

Aug 14, 2025
A few weeks ago, I saw a post on X where a farmer described an experiment to measure the heat retention of several thermoses. Can Bayesian statistics reveal the best one?
In search of the best thermos for mate with Thomas Bayes

When to fix the intercept

Aug 12, 2025
I was modeling a case where I knew Y at X = 0, forcing me to choose between giving the intercept a strong prior or fixing it. Too lazy to do the math by hand, I used a computational approach to check if that choice made sense.
When to fix the intercept

Data simulation with PyMC

Nov 1, 2024
Parameter recovery studies are crucial for assessing whether a model can accurately recover the true values of its parameters. In this post, I'll walk through a series of increasingly complex examples showing how to simulate data with PyMC in the context of such a study.
Data simulation with PyMC

How to create a custom family in Bambi?

Jan 14, 2023
Bambi now allows you to define custom statistical families in addition to its built-in distributions. This post illustrates the process with the Zero-Inflated Poisson (ZIP) distribution, showing how to implement it as a new family in Bambi and use it to simulate data, fit models, and assess their performance.
How to create a custom family in Bambi?

Let's use tidypolars more

Jun 26, 2022
In this blogpost I'm going to show how to perform the same task with pandas, the most popular library for data analysis in Python, and tidypolars, a new library to do data analysis with tabular data inspired on the tidyverse.
Let's use tidypolars more

Hierarchical modeling with the LKJ prior in PyMC

Jun 12, 2022
I describe how to use the `LKJCholeskyCov` and `LKJCorr` distributions to include correlated priors in Bayesian hierarchical modeling using PyMC.
Hierarchical modeling with the LKJ prior in PyMC

GSOC 2021: Final evaluation

Aug 17, 2021
Final post about Google Summer of Code 2021.
This post sums up my contributions to the Bambi library during the ten weeks of this program.
GSOC 2021: Final evaluation

Binomial family in Bambi

Aug 3, 2021
My fourth post describing work done during GSoC 2021. On this occasion, I'm introducing the Binomial family. This new family is very useful to build models for binary data when each row in the data set contains the number of successes and the number of trials instead of the results of Bernoulli trials.
Binomial family in Bambi

New families in Bambi

Jul 14, 2021
In this third post about my work during this Google Summer of Code I describe two families of models recently added. The first one, is the Student T family, used to make linear regressions more robust. The second, is the Beta family which can be used to model ratings and proportions.
New families in Bambi

Robust linear regression in Bambi

Jul 5, 2021
Second post about this Google Summer of Code season.
Today I show some of the problems associated with outliers in linear regression and demonstrate how one can implement a robust linear regression in Bambi.
Robust linear regression in Bambi

First weeks of GSoC

Jun 28, 2021
First post of a series about my contributions to Bambi in this Google Summer of Code season.
This post highlights new features related to default priors and priors for group-specific effects.
First weeks of GSoC

Design matrices for group-specific effects in formulae and lme4

Jun 8, 2021
Bambi uses the library formulae to automatically construct design matrices for both common and group-specific effects. This post compares design matrices for group-specific effects obtained with formulae for a variety of scenarios involving categorical variables with the ones obtained with the R package lme4.
Design matrices for group-specific effects in formulae and lme4

Why Bambi?

May 24, 2021
An example comparing how to fit a GLM with Bambi and PyMC3. Here I attempt to highlight how Bambi can help us to write a Bayesian GLM in a concise manner, saving us from having to realize error-prone tasks that are sometimes necessary when directly working with PyMC3.
Why Bambi?

How to generate bingo cards in R

Nov 3, 2020
A walkthrough the process of understanding how bingo cards are composed and a set of R functions that let us generate random bingo cards and print them in a nice looking .pdf output.
How to generate bingo cards in R
No matching items
     

    Copyright 2025, Tomás Capretto