Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Two-part coding for actor variables that only exist with a partner

Open
#86 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
64/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
data

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

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.