Dyadic Data Analysis in R

A practical guide to the Actor–Partner Interdependence Model with multilevel models and structural equation models

Dyadic Data Analysis in R

A complete, hands-on guide to estimating, interpreting, and reporting Actor–Partner Interdependence Models (APIM) using R.

Learn how to model two-person data correctly — when the people in your study are not independent.

What is the APIM?

The Actor–Partner Interdependence Model is the standard framework for analysing data in which two people’s responses are inherently linked — romantic partners, parent–child dyads, coworkers, doctor–patient encounters, even dyadic experiments.

It separates two kinds of effects:

  • Actor effects — the effect of my characteristic on my outcome.
  • Partner effects — the effect of my characteristic on my partner’s outcome.

Distinguishing the two requires accounting for the non-independence within each dyad. That is the central methodological move of the APIM, and it is what the rest of this site teaches you to do in R.

Who is this for?

This site is for applied researchers and graduate students who want to analyse dyadic data with R. You should be comfortable with linear regression and the basics of R. Basic or fundamental knowledge of multilevel models and structural equation modelling is assumed, as is working familiarity with the lme4 and lavaan packages.

How the site is organised

Foundations

Non-independence, the intraclass correlation, distinguishability, the four k-patterns, and the data structures APIM can handle.

Start here →

Tutorials — Indistinguishable dyads

Multilevel and SEM approaches when the two members of each dyad are interchangeable. Pooled slopes, no gender effect.

Tutorials →

Tutorials — Distinguishable dyads

Add gender (or any distinguishing variable) as a moderator. Compare MLM and SEM specifications. Test equality constraints.

Tutorials →

Tutorials — Moderated APIM

The full model: a dyad-level moderator (e.g. presence of children) shaping the partner crossover effect. Replication of Hahn, Binnewies, & Dormann (2014).

Tutorial →

Exercises

A nine-section problem set on a separate simulated dataset. Each section asks you to fit a model, interpret it, and reflect on the result. Hints and worked solutions are provided.

Practise →

Data & references

Variable lists, data-generating parameters, and the canonical reading list for APIM work in the social and organisational sciences.

Browse → · References →

A two-minute example

The model you will learn to fit looks like this in long format (one row per person):

\[\begin{align} \text{satisfaction}_{ij} = &\;\beta_0 + \beta_1 \text{wnc}_{ij} + \beta_2 \text{partner\_wnc}_{ij} \\ &+ \beta_3 \text{recovery}_{ij} + \beta_4 \text{partner\_recovery}_{ij} \\ &+ \beta_5 \text{has\_children}_j + \beta_6 \text{dual\_earner}_j \\ &+ u_{0j} + \varepsilon_{ij} \end{align}\]

where person \(i\) is nested in dyad \(j\), \(u_{0j}\) is the dyad-level random intercept, and \(\varepsilon_{ij}\) is the residual.

  • \(\beta_1\) is the actor effect of work–nonwork conflict.
  • \(\beta_2\) is the partner effect of conflict crossover.

The tutorials work through how to estimate, interpret, and report this model, and how to extend it to distinguishable dyads and moderation.

How to use this workshop

The workshop has three parts that you can use independently:

  1. Tutorials (online). Work through the Foundations, Indistinguishable, Distinguishable, and Moderated APIM sections in your browser. Each tutorial explains the model, shows the R code, and walks through the interpretation of the output.

  2. Data (download). The simulated datasets used in the tutorials are available under data/. Download them to your machine so you can load them into your own R session and follow along with the code, modify it, or run your own analyses. Variable definitions and data-generating parameters are listed on the same page.

  3. Scripts (download). The R scripts that produce every result shown in the tutorials are in the repository. Download them and open them in RStudio or your editor of choice to see the full workflow — model fitting, diagnostics, plots, and reporting — end to end.

Once you have worked through the tutorials, try the exercises: a nine-section problem set on a separate simulated dataset with hints and worked solutions.

Acknowledgements

These materials were originally developed for the EAOHP 2026 conference workshop Dyadic Data Analysis Using R. The simulation data structures emulate the work of Hahn, Binnewies, & Dormann (2014). The APIM framework rests on the work of Kenny, Kashy, Cook, and Ledermann, among many others; see the references for the full list.

Materials are by George Michaelides, released under CC BY 4.0.