Add arbitrary fixed-effect contrasts

This commit is contained in:
2026-08-13 13:39:33 +08:00
parent 8557daecac
commit 48ab77f9ab
8 changed files with 515 additions and 29 deletions

View File

@@ -27,6 +27,8 @@ The engine diagonalizes the GRM once, rotates the common design and every unique
- Variable numbers of extra fixed-effect covariates per task through a CSR index.
- Satterthwaite t/F fixed-effect inference by default, with optional
Kenward-Roger F tests and a joint test of task-specific covariates.
- Named arbitrary linear contrasts over the common fixed-effect design, using
the Satterthwaite or Kenward-Roger method selected for the run.
- Atomic block output and safe resume/force semantics.
- Generic Python CLI for manifest creation, validation, execution, provenance signatures, status, and result export.
@@ -114,11 +116,14 @@ python python/spectra_reml.py make-manifest \
--tasks data/tasks.tsv \
--extra-offsets data/extra_offsets.i64.bin \
--extra-indices data/extra_indices.i32.bin \
--contrast-matrix data/contrasts.f64.bin \
--contrast-metadata data/contrasts.tsv \
--output-dir work/blocks \
--n-samples 3523 \
--n-base-covariates 8 \
--n-phenotype-rows 10000 \
--n-extra-covariate-rows 2000
--n-extra-covariate-rows 2000 \
--n-contrasts 5
```
Validate, run, and export results:
@@ -141,6 +146,14 @@ python python/spectra_reml.py finalize \
`results.tsv.gz` retains the complete per-task summary and stores the fixed-effect vector and row-wise packed lower covariance as JSON arrays.
Optional named contrasts are supplied by `--contrast-matrix`,
`--contrast-metadata`, and `--n-contrasts`. Contrast rows act on `base_x`;
task-specific covariate columns receive zero weights automatically. Finalized
results contain contrast estimates, adjusted standard errors, statistics,
numerator and denominator degrees of freedom, and p-values as JSON arrays.
This release uses manifest v2, run-signature v2, block v3, and finalized-output
v2 contracts. It intentionally does not read older contracts.
Fixed-effect inference defaults to Satterthwaite. Select Kenward-Roger or turn
inference off with `--fixed-effect-test kenward-roger` or
`--fixed-effect-test none`. Coefficient-wise standard errors, statistics,