from pathlib import Path
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import lapylace as lp
sys.path.append(str(Path.cwd().parent / 'python'))
from data import ros_pathMetabolic
An example of how to interpret a power law or log-log regression. See Chapter 3 in Regression and Other Stories.
Animals’ body mass and metabolism comes from section 3.8.2 of Gelman and Nolan: Teaching Statistics: A Bag of Tricks, second edition. Oxford University Press, 2017.
Source: Metabolic/metabolic.Rmd.
The Python version keeps data handling explicit and uses lapylace for Stan-backed generalized linear models, so the statistical model can be read from a formula rather than from handwritten Stan.
Notes
- Source computation blocks represented: 7.
- Data paths are expressed through the shared
ros_path()helper. - Formula-based Bayesian regressions are routed through
lapylace.stan_glm(). - Plotting and simulation work uses NumPy, pandas, matplotlib idioms.