Skip to content

Pin vcov()'s diagonal fallback against a zero variance (A64 follow-up) - #67

Merged
davidhbernstein merged 1 commit into
mainfrom
test/vcov-fallback-zero-variance
Oct 27, 2026
Merged

davidhbernstein merged 1 commit into
mainfrom
test/vcov-fallback-zero-variance

Conversation

@davidhbernstein

Copy link
Copy Markdown
Owner

Pin vcov()'s diagonal fallback against a zero variance

A follow-up to #62, one test file and no code change.

When no Hessian can be inverted, vcov.sfareg() falls back to a diagonal built
by squaring the reported standard errors (R/sfareg_methods.R:209). A64's
clamp therefore reached it too: a parameter whose variance estimate came back
negative arrived here as 0 and contributed an exact zero variance — the same
claim of infinite precision, one level up. Since #62 it arrives as NA.

This is a characterization test, not a regression test, and the comment in it
says so.
vcov() itself is unchanged, so given the NA the test constructs,
it passes on main as well; what #62 changed is which value arrives. It is
worth pinning because the fallback squares whatever it is handed, so a
zero-fill or a pmax() reintroduced there would restore the defect silently
with every other A64 test still green.

The object is constructed rather than fitted, so — unlike #62's end-to-end
case, which had to be gated on skip_if_not(any(v < 0), ...) after all five CI
platforms disagreed with this Mac about whether the design reaches a negative
variance — this one cannot depend on an optimizer landing point.

test-a64-negative-variance-se.R: 19 of 19 pass against the main build at
5163c44. No R/ file is touched.

🤖 Generated with Claude Code

vcov() falls back to a diagonal built from the REPORTED standard errors
when no Hessian can be inverted, so A64's clamp reached it too: a
negative-variance parameter arrived as 0 and contributed an exact zero
variance -- the same claim of infinite precision, one level up.

This is a characterization test, not a regression test, and the comment
says so: vcov() itself is unchanged, and given the NA the test
constructs it passes on main as well. What changed upstream is which
value arrives. It is worth pinning because the fallback squares whatever
it is handed, so a zero-fill or a pmax reintroduced there would restore
the defect silently. Constructed rather than fitted, so it cannot depend
on an optimizer landing point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@davidhbernstein
davidhbernstein merged commit bffede5 into main Oct 27, 2026
5 checks passed
@davidhbernstein
davidhbernstein deleted the test/vcov-fallback-zero-variance branch October 27, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant