Skip to content

Fix binomial SE fallback with SVD pseudo-inverse#259

Merged
Lillyakasiken merged 2 commits into
furrer-lab:mainfrom
Lillyakasiken:246-fix-binomial-se-fallback
Jun 8, 2026
Merged

Fix binomial SE fallback with SVD pseudo-inverse#259
Lillyakasiken merged 2 commits into
furrer-lab:mainfrom
Lillyakasiken:246-fix-binomial-se-fallback

Conversation

@Lillyakasiken

Copy link
Copy Markdown
Contributor

Summary

  • Fix the binomial SE fallback in irls_binomial post-processing that used sqrt(svd()$d) instead of a proper SVD-based pseudo-inverse, producing mathematically inverted standard errors when solve() fails on near-singular Fisher information matrices.
  • Add testthat coverage for the SVD fallback path.

Closes #246

Test plan

  • SVD fallback matches solve() on well-conditioned PSD matrices
  • SVD fallback matches solve() on realistic logistic XtWX
  • SVD fallback matches solve() on real abn binomial node varcov
  • fitAbn returns finite positive SEs on near-singular varcov

@reinhardfurrer reinhardfurrer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

@reinhardfurrer

Copy link
Copy Markdown
Contributor

@Lillyakasiken : can you check how to pass the R_CMD_check_passed? I've approved your changes but I cannot issue this check (the others chould be checked and pass).

@Lillyakasiken

Copy link
Copy Markdown
Contributor Author

@Lillyakasiken : can you check how to pass the R_CMD_check_passed? I've approved your changes but I cannot issue this check (the others chould be checked and pass).

The check hasn't been triggered because the CRAN::check label hasn't been applied.

@Lillyakasiken
Lillyakasiken merged commit 22f9a50 into furrer-lab:main Jun 8, 2026
40 of 42 checks passed
@Lillyakasiken
Lillyakasiken deleted the 246-fix-binomial-se-fallback branch June 8, 2026 12:11
@Lillyakasiken

Lillyakasiken commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

test-coverage: https://github.com/furrer-lab/abn/actions/runs/27133785812/job/80083378275#step:6:433

1 & 2. tests/testthat/test-build_score_cache_bayes.R:26 — buildScoreCache.bayes()
The test wraps expect_equal in expect_error to assert two buildScoreCache(..., method="bayes", ...) calls produce different outputs. Both an inner equality check and the outer "expected an error" check fired. This is an INLA-based test (line 2: skip_on_cran()) — it doesn't run in the R_CMD_check matrix jobs.

3. tests/testthat/test-tographviz.R:181 — duplicate snapshot file name
Error: Snapshot file names must be unique. "graph.dot" has already been used.
Looking at the test file, the name "graph.dot" is used at lines 171, 181, and 191. Pre-existing test bug — should be graph2.dot, graph3.dot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing inverse of Fisher Information in fallback

2 participants