This is giving the correlation matrix
a uniform prior:
Lcorr ~ lkj_corr_cholesky(1);
Increasing the argument > 1 concentrates prior mass around the unit
correlation matrix.
for (n in 1:N) {
real GaussLogLike[K];
for (k in 1 :K)
GaussLogLike[k]
= log(pi_z[k])
+ multi_normal_cholesky_lpdf(X[n] | alpha[n] * sum_alpha/sum(alpha) * mu[k],
beta[n] * sum_beta/sum(beta) * diag_pre_multiply(sigma, Lcorr));
target += log_sum_exp(GaussLogLike);
}
You can make this multi-normal mixture much more efficient by pulling up
the shared calculations:
vector[N] a = alpha * sum_alpha / sum(alpha);
vecotr[N] b = beta * sum_beta / sum(beta)
real GaussLogLike[K];
for (n in 1:N) {
for (k in 1 :K)
GaussLogLike[k]
= log(pi_z[k])
+ multi_normal_cholesky_lpdf(X[n] | alpha[n] * sum_alpha/sum(alpha) * mu[k],
beta[n] * sum_beta/sum(beta) * diag_pre_multiply(sigma, Lcorr));
target += log_sum_exp(GaussLogLike);
}
I dont' know what cov(data) is. The point is that it's
being estimated here from the data. Same way as if you
have multivariate y[n] ~ multi_normal(mu, Sigma), you
estimate mu and Sigma from the y[n]. It's tied together
through the likelihood. You can't mu and Sigma vary by n
because then tere won't be any data to estimate them. But
that has nothing to do with Cholesky vs. Wishart.
I don't know enough about how VB works to provide help with
numerical issues there. I'm also not sure where lub_free
comes into play---that should be mapping a variable in
some finite range (l, u) back to ucnonstrained space. Maybe
it's used in a transform somewhere.
- Bob
> To unsubscribe from this group and all its topics, send an email to
stan-users+...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> <BISCUIT_ADVI_mv5_7.stan>