Skip to content

Add cross-sectional partner-dependence predictive checks - #18

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

Pascal-Kueng wants to merge 48 commits into
mainfrom
residual-diagnostics

Conversation

@Pascal-Kueng

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

Copy link
Copy Markdown
Owner

Adds descriptive checks of partner variation and dependence in cross-sectional dyads. The workflow predicts responses with conditional-model random effects set to zero, simulates complete datasets with new random-effect blocks, subtracts the same predictions from observed and simulated responses, and compares paired summaries in tables and plots.

Scope and implementation

  • Supports unweighted glmmTMB models without zero inflation for Gaussian, Poisson, negative binomial 1 and 2, Tweedie, Gamma, and beta responses. Prediction and simulation use the fitted link; the wrapper checks the family and requires finite scalar responses.
  • Provides model-centred or raw checks, with role-specific or exchangeable summaries. Undefined simulated statistics are counted explicitly.
  • Simulation results contain observed_response, simulated_responses, predicted_response, and model_frame. Model and simulation metadata live in attr(x, "dyadMLM"); simulation counts come from matrix dimensions.
  • Preserves fitted-row alignment and complete random-effect blocks, restores simulation settings, and preserves the caller's random-number state when a seed is supplied. Print methods retain their internal documentation keyword.
  • Keeps fitted parameters and study design fixed. These are descriptive predictive references, without refitting or parameter uncertainty; reference intervals and observed quantiles are not confidence intervals or calibrated p-values.

ILD checks, adapters for other response formats, and vignette integration remain follow-up work. Developer notes and the vignette draft are shortened and aligned with the public functions.

Validation

  • Built-source R CMD check --no-manual --ignore-vignettes: 0 errors, 0 warnings, 0 notes.
  • 1,566 passing test assertions, with no failures, warnings, or skips.
  • Actual Gaussian/log, Poisson/sqrt, and beta/probit fits match glmmTMB predictions and simulations, alongside the existing family, alignment, state-restoration, and plotting tests.
  • Generated help checked; developer simulation study rendered as an execution smoke check with one outer repetition and 20 inner simulations.

@Pascal-Kueng
Pascal-Kueng marked this pull request as ready for review August 26, 2026 00:36
Comment thread R/predictive_checks_dependence.R
Resolve identifiers in the fitted data mask, with explicit .data/.env access
and embraced wrapper arguments. Extract shared pair statistics, labels, and
reference summaries while preserving the current Gaussian check contract.

Cover name collisions and wrapper/single-simulation behavior; update the
development plan to rebuild generalized and ILD work from the accepted base.
Add plain-language comments describing response datasets, fitted-row and
partner indices, statistic vectors, reference tables, and plotting inputs.
Explain tidy evaluation and the simulation choices that preserve dependence.

Executable code and roxygen documentation are unchanged.
@Pascal-Kueng Pascal-Kueng changed the title Add Gaussian partner-dependence predictive checks Add cross-sectional partner-dependence predictive checks Sep 12, 2026
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