-
-
Notifications
You must be signed in to change notification settings - Fork 118
Issue/870 affine xform clarification #872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
8052139
4ede2d7
1eb1bc2
9383f77
c9731d2
168a99e
b3291de
a5dccff
acba64c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
+0 −136 | Jenkinsfile | |
+1 −2 | stan.xml | |
+0 −1 | theme-colors.scss | |
+4 −4 | theme-dark.scss | |
+2 −4 | theme.scss |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,8 +266,6 @@ funnel's neck is particularly sharp because of the exponential | |
function applied to $y$. A plot of the log marginal density of $y$ | ||
and the first dimension $x_1$ is shown in the following plot. | ||
|
||
|
||
|
||
The funnel can be implemented directly in Stan as follows. | ||
|
||
```stan | ||
|
@@ -327,14 +325,26 @@ model { | |
``` | ||
|
||
In this second model, the parameters `x_raw` and `y_raw` are | ||
sampled as independent standard normals, which is easy for Stan. These | ||
are then transformed into samples from the funnel. In this case, the | ||
same transform may be used to define Monte Carlo samples directly | ||
based on independent standard normal samples; Markov chain Monte Carlo | ||
methods are not necessary. If such a reparameterization were used in | ||
Stan code, it is useful to provide a comment indicating what the | ||
distribution for the parameter implies for the distribution of the | ||
transformed parameter. | ||
sampled as independent standard normals, which is easy for Stan, | ||
and then transformed into samples from the funnel. | ||
When this reparameterization is used in Stan code, a comment indicating what the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although they are technically reparameterizations under the hood, I think we should stick to calling them transforms. The terminology is confusing if you have any suggestions---the problem is that with the affine transform there is no constraining or unconstraining. The domain and range of the transform function are the same---it's just a bijection over the whole real number line. |
||
distribution for the parameter implies for the distribution of the transformed parameter | ||
will improve readibility and maintainability. | ||
|
||
As of Stan release v2.19.0, this program can be written using Stan's | ||
[affinely transformed real type](https://mc-stan.org/docs/reference-manual/types.html#affine-transform.section). | ||
The affine transform on the vector `x` is applied to each element of `x`. | ||
|
||
```stan | ||
parameters { | ||
real<multiplier=3> y; | ||
vector<multiplier=exp(y/2)>[9] x; | ||
} | ||
model { | ||
y ~ std_normal(); // implies y ~ normal(0, 3) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same issue as above. |
||
x ~ std_normal(); // implies x ~ normal(0, exp(y/2)) | ||
} | ||
``` | ||
|
||
### Reparameterizing the Cauchy {-} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.