Skip to content

Add Gaussian partner-dependence predictive checks - #18

Open
Pascal-Kueng wants to merge 37 commits into
mainfrom
residual-diagnostics
Open

Add Gaussian partner-dependence predictive checks#18
Pascal-Kueng wants to merge 37 commits into
mainfrom
residual-diagnostics

Conversation

@Pascal-Kueng

@Pascal-Kueng Pascal-Kueng commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add simulate_dyad_responses() to generate plug-in response datasets from cross-sectional Gaussian glmmTMB models.
  • Add check_partner_dependence() to compare observed and simulated partner variation and association.
    • Support model-centred and raw responses, meaningful member roles, and label-invariant summaries for interchangeable members.
    • Add help pages, examples, plots, tests, developer validation, and a known-population outer simulation study.

Scope and interpretation

This PR supports unweighted cross-sectional Gaussian identity-link glmmTMB models without zero inflation. The fitted parameters and fitted-row design remain fixed, while random effects and Gaussian errors are newly generated for each simulated dataset.

This is a descriptive plug-in predictive reference. The model is not refitted, parameter uncertainty is not included, and observations are not held out. Observed positions and middle 95% ranges are descriptive guides, not p-values or calibrated confidence intervals.

The check is likely most useful when the model makes a simplifying assumption that could be wrong (for example, no remaining partner relationship or equal variation across roles). When the model freely estimates the same feature from these data, close agreement is expected (learned patterns are reproduced).

For exchangeable dyads, the deterministic summary follows Woody and Sadler's (2005) between-/within-dyad decomposition. The observed-versus-simulated comparison adapts the principle from Gelman, Meng, and Stern (1996). It is not a posterior predictive distribution.

Review focus

Conceptual questions about the diagnostic target and interpretation are collected in Discussion #21.

  • Fitted-row alignment, pairing, and omitted-row handling
  • Whether the interpretation is clear and appropriately cautious
  • Readability of the API, output, and documentation

Validation

  • All package tests pass.
  • The independent Woody–Sadler/Dingy validation report renders with all assertions passing.
  • In the outer simulation study, all 7,000 fitted-model runs completed without warnings, convergence problems, or check errors.
  • The known-truth control behaved as expected: 4–7% of summaries fell outside the middle 95%, and position SDs were 0.275–0.290 versus 0.289 expected.
  • Flexible correct fits clustered tightly near the middle, showing why close agreement is not independent evidence of good fit. The deliberately wrong assumptions were flagged in the expected direction in 84.4–96.8% of datasets with 50 dyads and 100% with 200 dyads.

@Pascal-Kueng
Pascal-Kueng marked this pull request as ready for review August 26, 2026 00:36

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be shortened. The basic idea is:

  • apply criteria to simulation
  • apply criteria to prediction
  • plot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant