infer_dyad_compositions: Infer dyad compositions

View source: R/data_prep_compositions.R

infer_dyad_compositionsR Documentation

Infer dyad compositions

Description

Builds a dyad-level summary of role compositions from a validated dyadMLM_data object.

Usage

infer_dyad_compositions(
  data,
  seed = NULL,
  keep_compositions = NULL,
  set_exchangeable_compositions = NULL,
  pool_compositions = NULL,
  short_colnames = TRUE,
  include_arbitrary_member_contrast = FALSE
)

Arguments

data

A dyadMLM_data object returned by validate_dyad_data().

seed

Optional seed for random ⁠.member_contrast_*⁠ sign assignment. If NULL, the current R session's RNG state is used.

keep_compositions

Optional observed dyad compositions to keep before exchangeability overrides and pooling.

set_exchangeable_compositions

Optional dyad compositions to treat as exchangeable for analysis.

pool_compositions

Optional named list that pools exchangeable dyad compositions into user-named final composition labels. Each pool must resolve to at least two distinct observed compositions.

short_colnames

Whether to use shorter composition-dependent generated column names when the final data contain one composition.

include_arbitrary_member_contrast

Whether to also generate arbitrary ⁠.member_contrast_*⁠ columns for distinguishable compositions without changing their composition metadata, roles, or indicators.

Value

A dyadMLM_data object with added .composition and .composition_role factor columns, ⁠.is_*⁠ numeric indicator columns, composition-specific numeric ⁠.member_contrast_*⁠ columns coded -1 and 1 for the two members of each matching composition and 0 otherwise, and dyad composition metadata.


dyadMLM documentation built on Oct. 28, 2026, 1:06 a.m.