Prevent pool names from combining groups that should stay separate
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start at the name check in R/data_prep_compositions.R (around line 497) and read how composition labels are generated for individual roles after that check, so you can see which labels the check misses. Reproduce the issue with the exact example in the issue body, then add the conflict validation before indicator columns are created so it raises a clear error asking for a different pool name. Add a test for the example, plus one confirming ordinary pooling still yields separate indicators; done when the example errors and both tests pass.
Written by the indexing model from the issue text.
Description
prepare_dyad_data() lets users pool dyad compositions, meaning that selected types of dyads are treated as one group.
Some pool names cause an unrelated group to be included in the same generated model column. This happens without an error or warning and can make a fitted model treat groups as equal when the user intended to keep them separate.
For example, suppose the data contain A/B, C/C, and D/D dyads. The user pools C/C and D/D and calls that pool A_x_B_A. The package then gives the pooled members the same indicator as role A in the unpooled A/B dyads. An indicator is a column containing 1 for rows in a group and 0 for other rows.
Example
dat <- data.frame(
dyad = rep(1:3, each = 2),
member = rep(1:2, 3),
role = c("A", "B", "C", "C", "D", "D"),
x = 1:6
)
prepared <- dyadMLM::prepare_dyad_data(
dat, dyad, member,
role = role,
predictors = x,
pool_compositions = list(
A_x_B_A = c("C-C", "D-D")
),
seed = 1
)
as.data.frame(prepared)[, c(
"dyad", "role", ".composition_role", ".is_A_x_B_A"
)]
.is_A_x_B_A is 1 for both the A member of the A/B dyad and every member of the pooled C/C and D/D dyads.
Expected behavior
Stop with a clear error explaining that the pool name conflicts with another generated group label, and ask the user to choose a different name.
Suggested fix and checks
The current name check checks existing composition names but misses labels subsequently created for individual roles.
- Check for this conflict before creating the indicator columns.
- Add a test for the example above.
- Confirm that ordinary pooling still produces separate indicators for groups that were not pooled.
Keep the existing naming scheme and statistical calculations unchanged.
- Dominant language
- R
- Stars
- 1
- Forks
- 2
- Avg merge
- 9h 28m
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Pascal-Kueng/dyadMLM
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Pascal-Kueng/dyadMLM#92 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Pascal-Kueng/dyadMLM#83 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Pascal-Kueng/dyadMLM#71 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Pascal-Kueng/dyadMLM#70 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Pascal-Kueng/dyadMLM#69 ·
Maintainers usually reply within 1 day
All issues in Pascal-Kueng/dyadMLM
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
mitchelloharawild/ggtime#39 ·
-
enhancement good first issue help wanted
Difficulty 2/5 Half a day Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Breaking 🏴☠️ Consistency :green_apple: :apple:
Difficulty 1/5 Under an hour Newbie friendliness 70/100
easystats/bayestestR#789 ·
Maintainers usually reply within 1 day