Skip to content

Fix dev_skewnorm() residual sign to use the mode, not the mean - #144

Open
nehill197 wants to merge 1 commit into
mainfrom
fix-skewnorm
Open

Fix dev_skewnorm() residual sign to use the mode, not the mean#144
nehill197 wants to merge 1 commit into
mainfrom
fix-skewnorm

Conversation

@nehill197

Copy link
Copy Markdown
Member

The deviance magnitude is computed relative to the fitted distribution's mode (mode_sat), since that is provably where the saturated log-likelihood is achieved for a location family. But the residual sign was computed relative to the theoretical mean instead. For skewed shapes, mode != mean, so points between the two got a small deviance (close to the mode) but the wrong sign (below the mean), producing a gap in the residual distribution where no small positive (or negative) residuals could occur. Use mode_sat for the sign too, matching the reference point used for the magnitude.

dev_skewlnorm() inherits the fix since it delegates to dev_skewnorm().

The deviance magnitude is computed relative to the fitted
distribution's mode (mode_sat), since that is provably where the
saturated log-likelihood is achieved for a location family. But the
residual sign was computed relative to the theoretical mean instead.
For skewed shapes, mode != mean, so points between the two got a
small deviance (close to the mode) but the wrong sign (below the
mean), producing a gap in the residual distribution where no small
positive (or negative) residuals could occur. Use mode_sat for the
sign too, matching the reference point used for the magnitude.

dev_skewlnorm() inherits the fix since it delegates to dev_skewnorm().
@nehill197
nehill197 marked this pull request as draft July 17, 2026 19:16
@nehill197
nehill197 marked this pull request as ready for review July 17, 2026 20:24
@nehill197
nehill197 requested a review from joethorley July 17, 2026 20:25
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.

2 participants