easystats / easystats/modelbased

re.form: query about documentation

Open
#569 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

What's your opinion :hear_no_evil:
Dominant language
R
Stars
263
Forks
22
Avg merge
1h 22m
Merged PRs (30d)
11

Description

The Technical Note in https://easystats.github.io/modelbased/articles/mixed_models.html#generalized-linear-mixed-models says:

For backend = "marginaleffects", the re.form argument is set to NULL for mixed models by default, to calculate marginal predictions. You can use for instance re.form = NA in your estimate_means() call to change the default value (NA will produce conditional predictions).

Documentation of glmmTMB's predict function says:

re.form \code{NULL} to specify individual-level predictions; \code{~0} or \code{NA} to specify population-level predictions (i.e., setting all random effects to zero)

That seems contradictory to me, i.e. I read Tech Note as saying re.form=NA produces conditional predictions whereas glmmTMB is saying re.form=NA gives population-level predictions.

(I'm assuming that estimate_means with backend="marginaleffects" and estimate="average" calls marginaleffects::avg_predictions)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Technical Note in articles/mixed_models.html and the estimate_means() reference linked in the issue. Compare their re.form explanation with the linked glmmTMB predict documentation and the assumed marginaleffects::avg_predictions behavior. Done means the prediction terminology is reconciled and the documentation no longer appears contradictory.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.