Multi-membership models

Open
#330 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia
Domain
data

Research direction

Start by reviewing the allterms A-matrix handling and the updateL! path mentioned in the issue. Use the simulated person_1, person_2, and response data as a minimal example, then determine what is needed for symmetric multi-membership random effects. Done means the example can be fit with shared effects across both membership columns and the behavior is validated.

Written by the indexing model from the issue text.

Description

enhancement

This is following up on a post on the Julia discourse board.
In several mixed modeling packages in R, it is possible to fit multi-membership models where each row in a data matrix might belong to several groups that are captured by a single random effect(e.g., the mm function in brms ).
This functionality is useful for network models like the social relations models where you might be trying to predict whether two people are friends based on shared characteristics. You would also want to include random effects for each person (since some people might be friendlier than others) so you might set up a model as y ~ x + (1 | person_1) + (1 | person_2). However, it doesn't matter whether a person appears as person_1 or person_2 so you want to constrain the random effects to be symmetric across both columns.

For a frequentist example, Ben Bolker has shown how to implement it in lme4 by editing the random effects matrix prior to fitting. This is a request to implement the same functionality in MixedModels in order to take advantage of the speed relative to lme4.
@dmbates pointed out that it should be possible to do something similar by editing the A matrix in allterms.
and then running updateL! before fitting.

I'm not much of a Julia programmer but here is an attempt at some simulated data for the model I described above:

x = randn(100)
b = 1
REs = randn(10)
person_1 = repeat(1:10, inner=10)
person_2 = repeat(1:10, 10)
y = a + b * x + REs[person_1] + REs[person_2]
Dominant language
Julia
Stars
455
Forks
51
Avg merge
3d 15h
Merged PRs (30d)
4

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No 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.

More from JuliaStats/MixedModels.jl

All issues in JuliaStats/MixedModels.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.