Skip to content

Align R-side COM-Poisson functions with Stan - #1929

Open
LeonidasZhak wants to merge 1 commit into
paul-buerkner:masterfrom
LeonidasZhak:codex/brms-1927-com-poisson
Open

Align R-side COM-Poisson functions with Stan#1929
LeonidasZhak wants to merge 1 commit into
paul-buerkner:masterfrom
LeonidasZhak:codex/brms-1927-com-poisson

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Summary

Align the R-side com_poisson distribution functions and mean with the parameterization used by Stan.

Thanks to maintainers

Thanks to Paul and the brms maintainers for maintaining the package and for pointing out the preferred direction in the discussion of this issue.

Issue or motivation

Fixes #1927. After #1765 changed the Stan implementation, the R-side density, CDF, quantile, normalizing constant, and mean calculations still used the previous parameterization.

Root cause

The R functions multiplied the complete log-Poisson term by shape, whereas the updated Stan model applies shape only to the factorial term. The approximation formulas were also still expressed in terms of the previous parameterization.

Change

  • Align the exact R-side distribution and mean calculations with the current Stan formulas.
  • Port the corresponding normalizing-constant and mean approximations.
  • Keep vectorized CDF accumulation aligned for inputs with different cutoffs.
  • Add regression coverage for density, CDF, quantile, and mean calculations.

Tests

  • R CMD build --no-manual --no-build-vignettes .
  • R CMD check --as-cran --no-manual --ignore-vignettes brms_2.23.1.tar.gz: passed with the repository's existing two NOTES.
  • Full testthat.R run: passed.

Scope

This changes only the R-side calculations and regression coverage for com_poisson. It does not change the Stan implementation, the public function interface, or unrelated distributions and vignettes.

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.

com_poisson: Stan and R-side parameterisations diverged in #1765

1 participant