Is the implementation of a non-centered skew normal distribution really as simple as this?
data{
int N;
vector[N] x; // observed values
real tau; // homoskedastic error
}
parameters {
vector[N] y_raw; // normalized variable
real mu, alpha;
real<lower=0> sigma;
}
transformed parameters {
vector[N] y;
// transform
y = mu + sigma * y_raw;
}
model {
sigma ~ std_normal();
mu ~ std_normal();
alpha ~ normal(0,3);
y_raw ~ skew_normal(0,1,alpha);
x ~ normal(y, tau);
}
I have done some simulations and fits and it seems to work properly with no divergences... just feel simpler than it should be. I suppose the priors on alpha could affect the parameterization... but not sure.
Your parameterization estimate is different from skew_normal
of the centered.
There is a discussion and an posting in the old Google Stan Forum. It follows the
definition in wikipedia Skew normal distribution - Wikipedia
Ben Goodrich wrote:
For the general Wikipedia parameterization of the skew-normal, I think it would be
`// some priors on alpha, xi, and omegax ~ normal(xi, omega);lp__ <- lp__ + log(normal_cdf(alpha * x, xi, omega));`
but if xi = 0 and omega = 1, then
`// some prior on alphax ~ normal(0,1);`
`lp__ <- lp__ + log(Phi(alpha * x));`
> This is additional motivation for CDFs on the log scale
> in addition to numerical stability of truncation.
Indeed.
1 Like
@andre.pfeuffer thanks! do you have the link for the full post? I couldn’t find it and I would like to read the full post.
Thanks. This seemed to do the trick perfectly.