Two-part coding for actor variables that only exist with a partner
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 64/100
Research direction
Start in prepare_dyad_data(), where partner predictors are already two-part coded: locate where they are set to 0 when .partner_exists is 0, how the .partner_exists/.partner_exists_lag1 status columns are built, and how cbp levels gain the _when_exists/_before_exists/_after_exists suffixes. Add the partner_dependent_predictors argument and route those actor columns through the same path, then update the two-part terms listed in the message and in print(). Also update the help page and vignette("mixed-apim") workaround and extend the existing two-part tests; done when actor columns get identical treatment to partner columns and all current tests still pass.
Written by the indexing model from the issue text.
Description
Problem
With partner_exists, prepare_dyad_data() applies two-part coding to partner predictors: they are set to 0 where no partner existed, and the status columns (.partner_exists, its within/between parts, .partner_exists_lag1) mark these rows.
Some actor variables also only exist when a partner exists, for example ratings of the partner or of the relationship (perceived partner support, relationship satisfaction). They are usually missing where no partner exists, so rows without a partner drop out of models that use them.
Idea
An argument such as partner_dependent_predictors: a subset of predictors that only exist when a partner exists. Their actor columns would get the same treatment as partner columns:
- set to 0 where no partner existed (after centering), with lagged columns following the status at the previous occasion;
- in longitudinal data with status changes, the usual level (
cbp) split by partner status (_when_exists,_before_exists,_after_exists), as for partner usual levels; - listed in the two-part terms of the message and
print().
Workaround until then
The help and vignette("mixed-apim") show how to do this after preparing the data: set the actor columns to 0 where .partner_exists is 0 with dplyr::if_else(), and split the usual level by partner status in longitudinal data with status changes.
Not recommended
Moving such a variable to the partner's row, so that it becomes a partner predictor: it swaps the meaning of actor and partner columns, and it loses the person's own value when the partner has no row at that occasion (skipped or died).
- 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 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stan-dev/priorsense#150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
bennettoxford/opencodecounts#170 ·
-
Bug: derive_vars_dtm() invalid date error blames date_imputation and does not show the bad valuesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pharmaverse/admiral#3204 ·