add_dyad_individual_columns: Add dyad-individual predictor columns

View source: R/data_prep_dim.R

add_dyad_individual_columnsR Documentation

Add dyad-individual predictor columns

Description

Adds Dyad-Individual Model (DIM) style dyad-mean and within-dyad member-deviation columns for the predictors recorded in a dyadMLM_data object. DIM requires one final exchangeable dyad composition, which may result from pooling exchangeable compositions. Distinguishable dyads are not currently supported. For intensive longitudinal predictors decomposed by center_predictors(), raw predictors and within-person components are decomposed within each dyad-time occasion, while between-person components are decomposed once within each dyad. For raw predictors, the dyad-mean column is centered around the grand mean of dyad means, or dyad-occasion means in longitudinal data, while the within-dyad member-deviation column is the person's deviation from the uncentered dyad mean. Selected lag predictors additionally create lag-1 raw and within-person dyad-mean and within-dyad member-deviation columns.

Usage

add_dyad_individual_columns(data)

Arguments

data

A dyadMLM_data object returned by prepare_dyad_data().

Details

The function reads attr(data, "dyadMLM")$temporal_decompositions and stores the constructed DIM columns in attr(data, "dyadMLM")$dim_predictors.

Value

A dyadMLM_data object with dyad-mean and within-dyad member-deviation predictor columns added and DIM predictor metadata recorded.


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