Different syntax for MixedModels? What's the difference?

Hello.

I would like to use MixedModels.jl to fit regression models with random effects.
Looking at the official docs and some examples on the Internet I’ve found different syntaxes.

For example if I want to fit a Logit model (my outcome is binary) I can do it…:

fit(GeneralizedLinearMixedModel, @formula(y ~ 1 + x + (1 | id)), df, Bernoulli())
fit!(glmm(@formula(y ~ 1 + x + (1 | id)), df, Binomial(), LogitLink()))

What’s the difference between both syntaxes?

There shouldn’t be any difference. The JuliaStats ecosystem is moving towards a common API across packages that allows the user an intuitive and standard way to interact with various packages. StatsModels next release will solidify this change. In other words, the future will likely look as

model = fit(<:StatisticalModel, ::Formula, data, ...)
1 Like

I believe the outer fit! is superfluous in the example, no?