JuliaCon 2022 (Times are UTC)

TuringGLM.jl: Bayesian Generalized Linear models using @formula
2022-07-28 , Red

TuringGLM makes easy to specify Bayesian Generalized Linear Models using the formula syntax and returns an instantiated Turing model.

Example:

@formula(y ~ x1 + x2 + x3)

Heavily inspired by brms (uses RStan or CmdStanR) and bambi (uses PyMC3).


TuringGLM

TuringGLM makes easy to specify Bayesian Generalized Linear Models using the formula syntax and returns an instantiated Turing model.

Heavily inspired by brms (uses RStan or CmdStanR) and bambi (uses PyMC3).

@formula

The @formula macro is extended from StatsModels.jl along with MixedModels.jl for the random-effects (a.k.a. group-level predictors).

The syntax is done by using the @formula macro and then specifying the dependent variable followed by a tilde ~ then the independent variables separated by a plus sign +.

Example:

@formula(y ~ x1 + x2 + x3)

Moderations/interactions can be specified with the asterisk sign *, e.g. x1 * x2.
This will be expanded to x1 + x2 + x1:x2, which, following the principle of hierarchy,
the main effects must also be added along with the interaction effects. Here x1:x2
means that the values of x1 will be multiplied (interacted) with the values of x2.

Random-effects (a.k.a. group-level effects) can be specified with the (term | group) inside
the @formula, where term is the independent variable and group is the categorical
representation (i.e., either a column of Strings or a CategoricalArray in data).
You can specify a random-intercept with (1 | group).

Example:

@formula(y ~ (1 | group) + x1)

Data

TuringGLM supports any Tables.jl-compatible data interface.
The most popular ones are DataFrames and NamedTuples.

Supported Models

TuringGLM supports non-hiearchical and hierarchical models.
For hierarchical models, only single random-intercept hierarchical models are supported.

For likelihoods, TuringGLM.jl supports:

  • Gaussian() (the default if not specified): linear regression
  • Student(): robust linear regression
  • Logistic(): logistic regression
  • Pois(): Poisson count data regression
  • NegBin(): negative binomial robust count data regression

Associate Professor and Researcher of the Department of Computer Science at Universidade Nove de Julho - UNINOVE located in São Paulo - Brazil.
Lead on Education and Training at Pumas-AI.

Teaches undergraduate and graduate courses in Data Science, Statistics, Bayesian Statistics, Machine Learning and Deep Learning using Julia, R, Python, and Stan. Contributor to Julia, R and Stan ecosystems. Proficient in C/C++ and Rust.
Has published Julia, Rust, R, and Python packages in official repositories/registries.

Researches, publishes and advises PhD candidates on topics about Bayesian Statistical Modeling and Machine Learning applied to Decision Making.
Principal Investigator of LabCidades - Smart City Research Lab at UNINOVE.

Coauthor of Julia Data Science book.
Leads the development of education and training materials for Pumas users in Julia.
Member of the Stan Governing Body - SGB.
Member of the Turing.jl Developer Team.
Certified RStudio Tidyverse Instructor.