Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

User's Guide: Beta count-parameter prior does not match the cited BDA prior

已關閉 適合新手
#980 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

已經有一個關聯 PR 被合併了。

  • #981 來自 @avehtari —— 已合併

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
72/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
markdown
領域
documentation

研究方向

閱讀 src/stan-users-guide/reparameterization.qmd 中的「Beta and Dirichlet priors」段落,並將其中關於先驗的敘述和程式碼與引用的 BDA3 第 5.3 節比較。判斷兩個建議的修正方案中,哪一個能維持指南在數學上的一致性,然後視需要更新文字和程式碼。先驗與說明相符且 BDA 引用正確後,即告完成。

由索引模型根據 Issue 內容生成。

描述

In src/stan-users-guide/reparameterization.qmd, section "Beta and Dirichlet priors", the text says: "Following @[GelmanEtAl:2013, Chapter 5] the mean gets a uniform prior and the count parameter a Pareto prior with $p(\lambda) \propto \lambda^{-2.5}$." The code has lambda ~ pareto(0.1, 1.5);, which gives this density for $\lambda > 0.1$.

This is not the BDA prior. BDA3 Section 5.3 uses $p(\alpha, \beta) \propto (\alpha + \beta)^{-5/2}$. This density is on $(\alpha, \beta)$, not on $\lambda$. BDA3 gets it from a uniform prior on $(\alpha / (\alpha + \beta), (\alpha + \beta)^{-1/2})$.

The Jacobian of $(\phi, \lambda) \mapsto (\alpha, \beta) = (\lambda \phi, \lambda (1 - \phi))$ is $\lambda$. Thus:

  • The BDA prior on $(\phi, \lambda)$ is $p(\phi, \lambda) \propto \lambda \cdot \lambda^{-5/2} = \lambda^{-3/2}$.
  • The User's Guide prior on $(\alpha, \beta)$ is $p(\alpha, \beta) \propto \lambda^{-5/2} / \lambda = (\alpha + \beta)^{-7/2}$.

The exponent $-5/2$ of the $(\alpha, \beta)$ density seems to have been used for $\lambda$ without the Jacobian.

The difference changes the behavior of the prior. Let $u = \lambda^{-1/2}$. For large $\lambda$, $u$ is approximately $\mathrm{sd}(\theta) / \sqrt{\phi (1 - \phi)}$, and $u = 0$ means no variation between groups. The BDA prior is uniform on $u$. The User's Guide prior has density $\propto u^2$ on $u$, which is zero at $u = 0$.

Suggested fix (one of):

  1. Change the code to lambda ~ pareto(0.1, 0.5); and the text to $p(\lambda) \propto \lambda^{-3/2}$. Also say that the lower bound 0.1 makes the improper BDA prior proper.
  2. Keep the code and remove the statement that the prior follows BDA.

A proper alternative with the same $\lambda^{-3/2}$ tail is an exponential prior with rate $r$ on $\lambda^{-1/2}$, that is lambda ~ frechet(0.5, square(r)). It approximates a penalized complexity prior with the base model $\lambda = \infty$. Context: https://discourse.mc-stan.org/t/how-to-choose-a-prior-for-the-count-parameter/41653

主要語言
TeX
星號
43
分支
132
平均合併
17 小時 18 分鐘
30 天內合併 PR
19

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

stan-dev/docs 的其他 Issue

查看 stan-dev/docs 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。