Add enhanced AnimalBreeding toolkit - #11
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| A12 = isempty(others) ? zeros(0, length(geno_idx)) : A[others, geno_idx] | ||
| A11 = isempty(others) ? zeros(0, 0) : A[others, others] | ||
|
|
||
| inv_term = inv(Matrix(Gt)) - inv(Matrix(A22)) | ||
| top = isempty(others) ? Matrix(A22) : [A11 A12; transpose(A12) A22] | ||
| adj = zeros(size(top)) | ||
| adj[end-length(geno_idx)+1:end, end-length(geno_idx)+1:end] = inv_term | ||
| return Symmetric(top + adj) |
There was a problem hiding this comment.
Construct H with G_t−A22 rather than inverse difference
The docstring promises the single-step H relationship matrix, but the implementation builds the A matrix block and then adds inv(Gt) - inv(A22) to the genomic block. That mixes a covariance matrix (A) with inverse covariances, so the result is neither the expected H matrix nor the usual H⁻¹ formulation (which would start from A⁻¹). Downstream mixed-model equations that rely on H therefore receive numerically inconsistent entries, even when G and A22 are positive definite.
Useful? React with 👍 / 👎.
Summary
AnimalBreedingmodule with pedigree handling, relationship matrix construction, genomic matrix utilities, and mixed model solversTesting
https://chatgpt.com/codex/tasks/task_e_68de0fcb5d588321817528b786aa674e