A curated collection of Jupyter notebooks introducing and applying statistical methods and cosmological inference tools to problems in cosmology.
This repository combines:
- Practical statistical tutorials for students and researchers.
- Step-by-step Cobaya tutorials for Bayesian cosmological parameter estimation and model comparison, now included as a subfolder of the main tutorials.
- Probability & Statistics Refresher β Basics of probability distributions, likelihoods, and Bayesβ theorem.
- Bayesian Inference in Cosmology β MCMC, nested sampling, and posterior exploration with toy cosmological models.
- Fisher Forecasting β Deriving Fisher matrices and forecasting cosmological parameter constraints.
- Likelihoods for Cosmology β Building Gaussian and non-Gaussian likelihoods connected to cosmological data vectors.
- Applications β Toy SN & LSS parameter estimation, combining multiple probes, impact of priors and degeneracies.
- Cobaya β Sampling multi-variate Gaussian and Ring likelihoods; running simple cosmology chains & using the
get_model()wrapper in Cobaya to access all internal calculations without modifying the source code.
git clone https://github.com/your-username/Stats4Cosmology.git
cd Stats4Cosmologyjupyter labOpen any notebook under the tutorials/ folder to explore Stats4Cosmology, or navigate to tutorials/software/ for software specific exercises.
You can run Cobaya notebooks on Google Colab. For Cobaya specific notebooks you will need:
!pip install cobaya
!cobaya-install cosmo -p .The notebooks rely on standard scientific Python libraries widely used in astronomy and cosmology:
numpyβ numerical computingscipyβ scientific routinesastropyβ astronomy & cosmology utilitiesmatplotlibβ plottingseabornβ statistical visualizationjupyterβ interactive notebookscobayaβ cosmological Bayesian analysis (for Cobaya tutorials)
- Students in astrophysics, physics, or statistics wanting hands-on cosmological inference training.
- Researchers looking for ready-to-use templates for teaching, lectures, or experimentation.
- Educators needing practical examples for cosmology and data science courses.
- Anyone interested in learning how to use Cobaya for Bayesian cosmological analysis.
Developed and maintained by Dr. Guadalupe CaΓ±as-Herrera, inspired by real-world cosmological pipelines in the era of Euclid, probably biased by Planck 18 analysis experience.
This project is licensed under the MIT License β see the LICENSE file for details.
If you find these notebooks useful in your research or teaching, please cite:
@misc{stats4cosmology,
author = {CaΓ±as Herrera, Guadalupe},
title = {Stats4Cosmology: Jupyter notebooks for statistical methods in cosmology, including Cobaya tutorials},
year = {2025},
howpublished = {\url{https://github.com/gcanasherrera/Stats4Cosmology}}
}