Say where `.member_contrast_*` columns may be used

Open Beginner friendly
#175 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Voyagerroc is already working on this.

Since Nov 13, 2026.

  • #181 by @Voyagerroc — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
documentation

Research direction

Start with the prepare_dyad_data() help for its seed argument and return value, then find the exchangeable section of the APIM vignette. Add the suggested guidance in both places: use .member_contrast_* only in its own random-effect block, separate from the shared block. Done when both documentation locations include the same guidance.

Written by the indexing model from the issue text.

Description

documentation good first issue priority: low

The .member_contrast_* columns assign +1 and -1 to the two members of a dyad at random. The documented exchangeable model uses the column in one place only: a random-effect block of its own, next to a separate shared block. That model gives the same results for every seed.

Other uses depend on the random assignment. The docs call the assignment arbitrary, but they do not say where the column belongs.

Example

library(dyadMLM)
for (s in 1:3) {
  p <- prepare_dyad_data(
    dyads_cross, dyad = coupleID, member = personID, role = gender,
    keep_compositions = "female-female", model_types = "none", seed = s
  )
  m <- glmmTMB::glmmTMB(
    closeness ~ 1 + .member_contrast_arbitrary +   # fixed effect of the contrast
      us(1 | coupleID) + us(0 + .member_contrast_arbitrary | coupleID),
    dispformula = ~0, data = p
  )
  print(logLik(m))
}
#> -413.87, -413.46, -412.10

A single block such as us(1 + .member_contrast_arbitrary | coupleID) depends on the seed in the same way. recover_exchangeable_covariance() refuses that block. A fixed effect of the contrast is fitted without any message.

Suggested fix and checks

  • Add one sentence to the seed argument and the return value in the prepare_dyad_data() help.
  • Add the same sentence to the exchangeable section of the APIM vignette.
  • Suggested wording: "Use this column only in a random-effect block of its own, separate from the shared block. If results change with seed, the column is used somewhere else."
Dominant language
R
Stars
1
Forks
2
Avg merge
11h 4m
Merged PRs (30d)
42

Getting set up

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 Pascal-Kueng/dyadMLM

All issues in Pascal-Kueng/dyadMLM

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.