betanalpha / knitr_case_studies

Inference case studies in knitr
162 stars 94 forks source link

Half Normal or Log Normal #2

Closed apeterson91 closed 6 years ago

apeterson91 commented 6 years ago

Your gaussian processes 3 write-up states that the priors for the hyper parameters are half normal,

e.g. $$\alpha \sim $ half- $\mathcal{N}(0,2)$$

and the corresponding code is parameters{ ... real<lower=0> alpha; } model{ alpha ~ normal(0,2); ... }

But according to the stan reference manual (v 2.16.0) pg. 400: "If a variable X is declared to have a lower bound $a$, it is transformed to be an unbounded random variable $Y$, where ."

$$ Y = log (X - A)$$

which in this case would just be the log, suggesting that the new random variable is log normal, not half - would you mind clearing up this discrepancy for me?

I'm using a similar parameterization in a model I'm working with and would like to know the "real" prior distribution I'm using. - Many Thanks.

betanalpha commented 6 years ago

Stan automatically adds the Jacobian to ensure that we are indeed specifying a half normal distribution and not a log normal distribution. Please consult the Stan manual for more information.