https://github.com/bambinos/formulae
Formulas for mixed-effects models in Python
https://github.com/bambinos/formulae
bambi mixed-models python wilkinson-formulas
Last synced: 6 months ago
JSON representation
Formulas for mixed-effects models in Python
- Host: GitHub
- URL: https://github.com/bambinos/formulae
- Owner: bambinos
- License: mit
- Created: 2020-12-18T02:24:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-01-30T22:13:57.000Z (over 1 year ago)
- Last Synced: 2025-03-28T10:04:53.957Z (over 1 year ago)
- Topics: bambi, mixed-models, python, wilkinson-formulas
- Language: Python
- Homepage: https://bambinos.github.io/formulae/
- Size: 6.69 MB
- Stars: 58
- Watchers: 4
- Forks: 14
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://badge.fury.io/py/formulae)
[](https://codecov.io/gh/bambinos/formulae)
[](https://github.com/ambv/black)
# formulae
formulae is a Python library that implements Wilkinson's formulas for mixed-effects models. The main difference with other implementations like [Patsy](https://github.com/pydata/patsy) or [formulaic](https://github.com/matthewwardrop/formulaic) is that formulae can work with formulas describing a model with both common and group specific effects (a.k.a. fixed and random effects, respectively).
This package has been written to make it easier to specify models with group effects in [Bambi](https://github.com/bambinos/bambi), a package that makes it easy to work with Bayesian GLMMs in Python, but it could be used independently as a backend for another library. The approach in this library is to extend classical statistical formulas in a similar way than in R package [lme4](https://CRAN.R-project.org/package=lme4).
## Installation
formulae requires a working Python interpreter (3.8+) and the libraries NumPy, SciPy and Pandas with versions specified in the [pyproject.toml](https://github.com/bambinos/formulae/blob/master/pyproject.toml) file.
Assuming a standard Python environment is installed on your machine (including pip), the latest release of formulae can be installed in one line using pip:
`pip install formulae`
Alternatively, if you want the development version of the package you can install from GitHub:
`pip install git+https://github.com/bambinos/formulae.git`
## Documentation
The official documentation can be found [here](https://bambinos.github.io/formulae)
## Notes
- The `data` argument only accepts objects of class `pandas.DataFrame`.
- `y ~ .` is not implemented and won't be implemented in a first version. However, it is planned to be included in the future.