Stan


16

Eu estava revisando a documentação do Stan, que pode ser baixada aqui . Eu estava particularmente interessado na implementação do diagnóstico Gelman-Rubin. O artigo original Gelman & Rubin (1992) define o potencial fator de redução de escala (PSRF) da seguinte maneira:

Deixe que Xi,1,…,Xi,N ser o i th cadeia de Markov amostrado, e que não haja geral M cadeias independentes amostrados. Deixe X¯i⋅ ser a média do i th da cadeia, e X¯⋅⋅ ser o global significativo. Definir,

W=1M∑m=1Msm2,
onde E defina B B = N
sm2=1N−1∑t=1N(X¯mt−X¯m⋅)2.
B
B=NM−1∑m=1M(X¯m⋅−X¯⋅⋅)2.

Definir V = ( N - 1 O PSRF é estimado com √

V^=(N−1N)W+(M+1MN)B.
em que R= VR^ Onde d f = 2 V / V um r ( V ) .
R^=V^W⋅df+3df+1,
df=2V^/Var(V^)

A documentação Stan na página 349 ignora o prazo com e também remove o ( M + 1 ) / H multiplicativo prazo. Essa é a fórmula deles,df(M+1)/M

O estimador de variância é Finalmente, a estatística de redução de escala potencial é definido por R = √

var^+(θ|y)=N−1NW+1NB.
R^=var^+(θ|y)W.

Pelo que pude ver, eles não fornecem uma referência para essa mudança de fórmula e nem discutem isso. Geralmente não é muito grande e geralmente pode ser tão baixo quanto 2 , portanto ( M + 1 ) / M não deve ser ignorado, mesmo que o termo d f possa ser aproximado com 1.M2(M+1)/Mdf

Então, de onde vem essa fórmula?


Edição: Encontrei uma resposta parcial para a pergunta "de onde vem essa fórmula? ", Em que o livro Bayesian Data Analysis de Gelman, Carlin, Stern e Rubin (Segunda edição) tem exatamente a mesma fórmula. No entanto, o livro não explica como / por que é justificável ignorar esses termos?


Ainda não há um artigo publicado, e a fórmula provavelmente mudará nos próximos meses.
— Ben Goodrich

@ BenGoodrich Obrigado pelo comentário. Você pode dizer mais alguma coisa sobre a motivação de usar essa fórmula? E por que exatamente a fórmula mudará?
— Greenparker

11
A fórmula atual do R-hat dividido é a maneira mais comum de aplicá-la ao caso em que existe apenas uma cadeia. As próximas mudanças são principalmente para lidar com o fato de que a distribuição posterior marginal subjacente pode não ser normal ou ter uma média e / ou variação.
— Ben Goodrich

11
@BenGoodrich Sim, entendo por que a STAN divide Rhat. Mas mesmo neste caso , e assim a constante ( M + 1 ) / H = 3 / 2 , que não é ignorada. M=2(M+1)/M=3/2
— Greenparker

Respostas:


4

σ^=n−1nW+1nB
σ^σ^+var^+

var^+

R^=m+1mσ^+W−n−1mn,
which can be rearranged as
R^=σ^+W+σ^+Wm−n−1mn.
We can see that the effect of second and third term are negligible for decision making when n is large. See also the discussion in the paragraph before Section 3.1 in Brooks & Gelman (1998).

Gelman & Rubin (1992) also had the term with df as df/(df-2). Brooks & Gelman (1998) have a section describing why this df corretion is incorrect and define (df+3)/(df+1). The paragraph before Section 3.1 in Brooks & Gelman (1998) explains why (d+3)/(d+1) can be dropped.

It seems your source for the equations was something post Brooks & Gelman (1998) as you had (d+3)/(d+1) there and Gelman & Rubin (1992) had df/df(-2). Otherwise Gelman & Rubin (1992) and Brooks & Gelman (1998) have equivalent equations (with slightly different notations and some terms are arranged differently). BDA2 (Gelman, et al., 2003) doesn't have anymore terms σ^+Wm−n−1mn. BDA3 (Gelman et al., 2003) and Stan introduced split chains version.

My interpretation of the papers and experiences using different versions of R^ is that the terms which have been eventually dropped can be ignored when n is large, even when m is not. I also vaguely remember discussing this with Andrew Gelman years ago, but if you want to be certain of the history, you should ask him.

Usually M is not too large, and can often be as low so as 2

I really do hope that this is not often the case. In cases where you want to use split-R^ convergence diagnostic, you should use at least 4 chains split and thus have M=8. You may use less chains, if you already know that in your specific cases the convergence and mixing is fast.

Additional reference:

  • Brooks and Gelman (1998). Journal of Computational and Graphical Statistics, 7(4)434-455.

Yes it has the same σ^2 as you mention, but their R^ statistic is (σ^2+B/mn)/W∗dfterm (look at the equation on top of page 495 in the Stat Science official version), which introduces the (m+1)/m term I was talking about. In addition, look at the code and description in the R package coda, which has had the GR diagnostic since 1999.
— Greenparker

I'm confused. The article via the link you provided and the article from Stat Science web pages has only pages 457-472.I didn't check now, but years ago and last year when I checked coda, it didn't have the current recommended version.
— Aki Vehtari

Note that I edited my answer. Gelman & Brooks (1998) has that (m+1)/m term more clearly, and it seems you missed the last term which mostly cancels the effect of (m+1)/m term for decision making. See that paragraph before section 3.1.
— Aki Vehtari

Sorry about that, that was a typo. It's page 465, and Gelman and Rubin have the same exact definition as Brooks and Gelman (which you state above). Equation 1.1 in Brooks and Gelman is exactly what I wrote down as well (when you rearrange some terms).
— Greenparker

"We can see that the effect of second and third term are negligible for decision making when n is large", so what you are saying is that the expression in BDA and hence STAN comes from essentially ignoring these terms for large n?
— Greenparker
Ao utilizar nosso site, você reconhece que leu e compreendeu nossa Política de Cookies e nossa Política de Privacidade.
Licensed under cc by-sa 3.0 with attribution required.