about summary refs log tree commit diff
path: root/docs
diff options
context:
space:
mode:
authorPjotr <wrk@bosa.lan>2026-11-11 15:54:15 +0000
committerPjotr <wrk@bosa.lan>2026-11-11 15:54:15 +0000
commitcd3e65b6a03827d328aecb88c94406e85e5c161b (patch)
treee1e9eeeea62db5abcac7bfd466a05bfce5547e1d /docs
parent54d704ab7a6ec6e39ccb66e08c2334652a437cfa (diff)
downloadgenenetwork4-cd3e65b6a03827d328aecb88c94406e85e5c161b.tar.gz
gemma: report GEMMA's own pve for the null model
The GWA step now passes -pve, and the reply gains a note with the
variance components GEMMA computed for the null model. Under --loco
there is one per chromosome, so the note gives their range and names
the two that bound it:

  GEMMA -pve, null model, per chromosome (LOCO): pve 0.3118 to 0.9549
  over 20 chromosomes -- lowest 8 pve 0.3118 +/- 0.5009 (vg 23.3659, ve
  12.3389), highest 7 pve 0.9549 +/- 0.3570 (vg 76.0933, ve 0.8661).

That is BXD::10001 measured, not assumed. pve is the proportion of
variance the kinship explains -- the same quantity as /compute/bulklmm's
h2, per chromosome rather than genome-wide -- which is what the
16627/16769 comparison against BulkLMM needed.

Reading the numbers took three decisions worth stating:

- Four decimals is wrong for variance components. The first live run
  reported 'vg 0.0000, ve 0.0000' for a BXD::16769 null fit whose real
  components are 3.411e-5 and 3.411e-10 -- both rounded to zero, which
  reads as 'no variance' when the split is 1.0. Components are printed
  with four significant figures, scientific when the magnitude needs it,
  the way GEMMA's own logs do with %g.
- se(pve) is -nan on a boundary, and Rust parses -nan as a NaN f64, so
  the numeric parse alone let it through as NaN. Non-finite values are
  now 'not available': a boundary estimate has no standard error.
- Twenty chromosomes of values bury the other notes, and every value is
  in the .log.txt beside the archive anyway, so the note names the ends.

Requires gemma-wrapper 5eb53fa, which keeps each run's .log.txt beside
its archive instead of only inside the .tar.xz.

Docs: README's /compute/gemma section, SKILL's gemma bullet (compare pve
with h2, never vg with sigma2_e -- pve is scale-free), and
docs/bulklmm.md's 'what would settle it', which now says the plumbing is
in rather than pending.
Diffstat (limited to 'docs')
-rw-r--r--docs/bulklmm.md39
-rw-r--r--docs/www/SKILL.md9
2 files changed, 34 insertions, 14 deletions
diff --git a/docs/bulklmm.md b/docs/bulklmm.md
index 84ebe4d..d416860 100644
--- a/docs/bulklmm.md
+++ b/docs/bulklmm.md
@@ -98,20 +98,31 @@ are estimating different things, and it is worth knowing which:
       ## vg estimate in the null model = 0
       ## ve estimate in the null model = 0
 
-  So the flag works with `-lmm 9`; what was missing is the plumbing. Two
-  wrapper changes are in `gemma-wrapper` (5eb53fa, awaiting push and a pin
-  bump): the per-run `.log.txt` files are copied **beside** the archive (they
-  were only inside the `.tar.xz`, so reading `pve` meant unpacking a
-  multi-megabyte archive), and a failing child's own `ERROR`/`****` lines are
-  printed before the Ruby backtrace. With those, `/compute/gemma` can pass
-  `-pve` on the GWA step and read `pve`/`vg`/`ve` per chromosome out of
-  `<hash>.<chr>.cXX.txt.log.txt` — and report them beside `l_mle`, which is what
-  the 16627/16769 comparison needs.
-
-  Note what GEMMA itself returned on random data: `se(pve) = -nan` with
-  `vg = ve = 0`. On a boundary GEMMA's own standard error is not a number, so a
-  boundary pve is a direction, not a proportion — the same caveat as BulkLMM's
-  `h2`, from the other engine.
+  So the flag works with `-lmm 9`; what was missing was the plumbing, and that
+  is now in. `gemma-wrapper` 5eb53fa copies each run's `.log.txt` **beside** the
+  archive (they were only inside the `.tar.xz`, so reading `pve` meant unpacking
+  a multi-megabyte archive), and `/compute/gemma` passes `-pve` on the GWA step
+  and reports the components per chromosome:
+
+  > GEMMA -pve, null model, per chromosome (LOCO): pve 0.3118 to 0.9549 over 20
+  > chromosomes -- lowest 8 pve 0.3118 ± 0.5009 (vg 23.3659, ve 12.3389),
+  > highest 7 pve 0.9549 ± 0.3570 (vg 76.0933, ve 0.8661).
+
+  (BXD::10001, 34 animals, LOCO, `-lmm 9`.) That is the number the 16627/16769
+  comparison lacked: GEMMA's own `h2`, per chromosome, objective function
+  named. Where the two engines still disagree, the disagreement is now between
+  two printed variance components rather than between a number and an
+  inference.
+
+  Two caveats, both measured. GEMMA prints `-nan` for `se(pve)` when the
+  estimate sits on a boundary, and this build reports that as "not available"
+  rather than as a number; a boundary pve is a direction, not a proportion — the
+  same caveat as BulkLMM's `h2`, from the other engine. And the components are
+  on the phenotype's own scale, so a trait measured in thousandths gives
+  variances in thousandths: BXD::16769 (values 0.0012-0.0122, 36 animals) yields
+  `pve 1.0000 ± 0.0016 (vg 3.411e-5, ve 3.411e-10)` — pve is scale-free and
+  still reads 1.0, but the absolute numbers are meaningless to compare across
+  traits. Compare `pve` with `h2`, not `vg` with `σ²_e`.
 * **BulkLMM's likelihood over an h2 grid.** The package has
   `BulkLMM.profile_LL(y::Matrix, G, covar, K, h2_grid, markerID; reml)` (internal,
   not exported), returning `(ll_list_null, ll_list_alt)` over the grid. It wants
diff --git a/docs/www/SKILL.md b/docs/www/SKILL.md
index ab403d4..d070388 100644
--- a/docs/www/SKILL.md
+++ b/docs/www/SKILL.md
@@ -141,6 +141,15 @@ header (peak, and the reference lines drawn when you asked for them).
   ("each maternal-allele copy lowers the trait by X" / the other way) and
   remember it is *this run* on these samples, not the `additive` in trait info,
   which came from the published mapping.
+  A note also carries GEMMA's own variance component for the null model
+  (`-pve`): under LOCO there is one per chromosome, so it gives the range and
+  names the two that bound it, e.g. `pve 0.31 to 0.95 over 20 chromosomes`.
+  `pve` is the share of variance the kinship explains — the same quantity as
+  `/compute/bulklmm`'s `h2`, per chromosome instead of genome-wide — so it is
+  the honest way to check the two engines against each other. It is
+  scale-free: compare `pve` with `h2`, never `vg` with `σ²_e`. A `pve` of
+  exactly 0 or 1 is a boundary (the standard error then reads "not
+  available"), a direction rather than a proportion.
 * `/compute/fitqtl`: **how big** an effect is, not just where. Give it the
   marker names a scan found (its peaks) and it fits R/qtl's `fitqtl` at
   each: columns `marker, chr, pos, lod, pct_var, additive, se, t, p`. Use it