Skip to content

Temporal - #160

Open
smasongarrison wants to merge 126 commits into
mainfrom
temporal
Open

smasongarrison wants to merge 126 commits into
mainfrom
temporal

Conversation

@smasongarrison

Copy link
Copy Markdown
Member

This pull request introduces support for temporal pedigree models in the BGmisc package, along with several related utility functions and improvements for error handling, matrix processing, and code organization. The most significant changes are the addition of temporal model wrappers, enhancements to matrix handling for OpenMx compatibility, and improved ID cleaning utilities. There are also updates to documentation, versioning, and import statements.

Temporal pedigree model support:

  • Added new functions to build and fit temporal pedigree models, including buildTemporalPedigreeModelCovariance, buildOneTemporalFamilyGroup, buildTemporalFamilyGroups, buildTemporalFamilyGroups_list, buildTemporalPedigreeMx, and fitTemporalPedigreeModel. These are wrappers around existing model-building functions, enabling temporal-specific workflows. [1] [2] [3]
  • Documented the addition of temporal pedigree models in NEWS.md.

Utility and helper functions:

  • Added condenseMatrixSlots for memory optimization of large OpenMx models, make_clean_personids to sanitize IDs for OpenMx, and alignPhenToMatrix to prepare phenotype data for modeling. [1] [2]
  • Added as_numeric_matrix and make_symmetric functions for robust matrix coercion and symmetrization, ensuring compatibility with OpenMx requirements.

Code maintenance and imports:

  • Updated NAMESPACE with new exports for temporal modeling and helper functions, and reorganized import statements for clarity and maintainability. [1] [2] [3]
  • Improved parent ID validation logic in checkParents.R for more accurate error messages and handling of NA values.

Documentation and versioning:

  • Updated package version to 1.9.0.9 and increased the required roxygen2 version in DESCRIPTION. [1] [2]
  • Added data notes and a new script for genealogical distance testing in data-raw/. [1] [2]

smasongarrison and others added 30 commits July 6, 2026 17:43
Adds R/buildTemporalPedigreeModel.R with functions for building and fitting temporally-moderated pedigree variance component models using OpenMx. Includes buildTemporalPedigreeModelCovariance, buildOneTemporalFamilyGroup, buildTemporalFamilyGroups, buildTemporalFamilyGroups_list, buildTemporalPedigreeMx, and fitTemporalPedigreeModel.

Also adds a smoke test script in data-raw/ that simulates pedigrees with BGmisc, constructs relatedness matrices, generates phenotype data from a temporal A+E model, and fits intercept-only, linear-time, and historical-moderator AE models.
Adds an inline note in `buildTemporalPedigreeModel.R` clarifying the `Eta_k = Tpoly %*% B_k + H %*% G_k` formulation. Updates the temporal AE full smoke-test setup to use a nonzero second `e` beta coefficient (`0.10`), so the test data reflects temporal structure beyond the intercept.
Adds a `time_point_max` option to temporal pedigree model construction so beta labels/values and polynomial time basis can be generated beyond the fixed 0:3 setup. The smoke test script was expanded to support richer simulation controls (birth-year settings, family IDs, updated thresholds/true parameters), retain raw birth years in outputs, and add exploratory plotting of simulated phenotypes and recovered variance curves.
Extract shared temporal smoke-test helpers into `data-raw/smoketest_helpers.R` and update the full AE smoke test to source them, use new simulation settings, and report parameter estimates across model stages. This also changes `buildOneFamilyGroup()` to default `use_exp_loadings` to `FALSE` and updates the Rd usage accordingly.
Resolved the replication failure in `temporal_basic_mc.R` by replacing the faulty `vapply` summary logic (which triggered the missing `FUN.VALUE` error) with robust pooled calculations for `mean_H` and `z_year`. Added a new Figure A workflow that computes, plots, and exports time-varying variance-component recovery outputs (CSV/PNG/PDF). Regenerated temporal AE recovery artifacts now show full convergence and populated parameter/replication summaries.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@smasongarrison smasongarrison linked an issue Oct 8, 2026 that may be closed by this pull request
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

Add generation number computation

2 participants