Repository navigation
Temporal - #160
Open
smasongarrison wants to merge 126 commits into
Open
Temporal#160smasongarrison wants to merge 126 commits into
smasongarrison wants to merge 126 commits into
Conversation
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.
note that adding a mean value seems to get sucked into the historic effect
Up to standards ✅🟢 Issues
|
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
buildTemporalPedigreeModelCovariance,buildOneTemporalFamilyGroup,buildTemporalFamilyGroups,buildTemporalFamilyGroups_list,buildTemporalPedigreeMx, andfitTemporalPedigreeModel. These are wrappers around existing model-building functions, enabling temporal-specific workflows. [1] [2] [3]NEWS.md.Utility and helper functions:
condenseMatrixSlotsfor memory optimization of large OpenMx models,make_clean_personidsto sanitize IDs for OpenMx, andalignPhenToMatrixto prepare phenotype data for modeling. [1] [2]as_numeric_matrixandmake_symmetricfunctions for robust matrix coercion and symmetrization, ensuring compatibility with OpenMx requirements.Code maintenance and imports:
checkParents.Rfor more accurate error messages and handling of NA values.Documentation and versioning:
roxygen2version inDESCRIPTION. [1] [2]data-raw/. [1] [2]