Skip to content

Commit a6099b2

Browse files
authored
Merge pull request #865 from stan-dev/bugfix/844-Neals-funnel-refs
Neal's funnel density and non-centered sample plot side-by-side with single caption explaining both.
2 parents c360c60 + 51fcae0 commit a6099b2

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/stan-users-guide/efficiency-tuning.qmd

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,6 @@ function applied to $y$. A plot of the log marginal density of $y$
267267
and the first dimension $x_1$ is shown in the following plot.
268268

269269

270-
The marginal density of Neal's funnel for the upper-level variable $y$ and one lower-level variable $x_1$ (see the text for the formula). The blue region has log density greater than -8, the yellow region density greater than -16, and the gray background a density less than -16.
271-
272-
![Neal's funnel density](img/funnel.png)
273270

274271
The funnel can be implemented directly in Stan as follows.
275272

@@ -289,16 +286,23 @@ the neck of the funnel, where $y$ is small and thus $x$ is constrained
289286
to be near 0. This is due to the fact that the density's scale
290287
changes with $y$, so that a step size that works well in the body will
291288
be too large for the neck, and a step size that works in the neck will be
292-
inefficient in the body. This can be seen in the following plot.
289+
inefficient in the body. This can be seen in the following plots.
290+
291+
::: {#fig-funnel layout="[55, 45]"}
292+
293+
![](img/funnel.png)
294+
295+
![](img/funnel-fit.png)
296+
293297

294-
4000 draws are taken from a run of Stan's sampler with default settings. Both
295-
plots are restricted to the shown window of $x_1$ and $y$ values; some
296-
draws fell outside of the displayed area as would be expected given
298+
Neal's funnel. (Left) The marginal density of Neal's funnel for the upper-level variable $y$ and one lower-level variable $x_1$ (see the text for the formula). The blue region has log density greater than -8, the yellow region density greater than -16, and the gray background a density less than -16.
299+
(Right) 4000 draws are taken from a run of Stan's sampler with default settings.
300+
Both plots are restricted to the shown window of $x_1$ and $y$ values;
301+
some draws fell outside of the displayed area as would be expected given
297302
the density. The samples are consistent with the marginal density
298303
$p(y) = \textsf{normal}(y \mid 0,3)$, which has mean 0 and standard
299304
deviation 3.
300-
301-
![](img/funnel-fit.png)
305+
:::
302306

303307
In this particular instance, because the analytic form of the density
304308
from which samples are drawn is known, the model can be converted to

src/stan-users-guide/regression.qmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,8 @@ y_n & \sim \textsf{normal}(x_n \beta, \sigma) \\
875875
In this case, as $\tau \rightarrow 0$ and $\beta_k \rightarrow 0$, the
876876
posterior density
877877
$$ p(\beta,\tau,\sigma|y,x) \propto p(y|x,\beta,\tau,\sigma) $$
878-
grows without bound. See the [plot of Neal's funnel density](#funnel.figure), which has similar behavior.
878+
grows without bound.
879+
See the [Neal's funnel density](efficiency-tuning.qmd#funnel.figure), which has similar behavior.
879880

880881
There is obviously no MLE estimate for $\beta,\tau,\sigma$ in such a
881882
case, and therefore the model must be modified if posterior modes are

0 commit comments

Comments
 (0)