Hi:I suppose someone might have asked this question before, however I could not find it in the mailing list. While setting a multivariate normal distribution, I need to declare a vector column from this distribution. Eg.real tmp[M,N]tmp[,i] ~ multi_normal(mu, Sigma) ( use R's syntax )
vector[M] tmp[N]
matrix[M,N] tmp;
--
You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks Ben and Bob for your kindly reply. I actually simplified my question above. Due to the structure of my model, I both need column and row vectors to define a muti_normal and Dirichlet distribution. (That's the reason why I did not use vector[M] tmp[N] ) Below is my code that works in stan. But, I feel uncomfortable about the "transformed parameters" part. Even through the speed to draw samples from this model is quick, it waste memory to store the transform of matrix alpha.
I feel col(tmp, i) should works in my situation. However, while I have a three dimension array likereal tmp[M,N,P];how could I get row, column and ranks vector and some sub-matrix like tmp[1, , ] in a same framework ?
transformed data {vector[T] mu;cov_matrix[T] Sigma;for (i in 1:T)mu[i] <- 0;for (i in 1:T)for(j in 1:T)Sigma[i,j] <- exp(-pow(time[i] - time[j], 2)) +if_else(i == j, 0.1, 0.0);}
model {for(i in 1:M){alpha[i] ~ multi_normal(mu, Sigma);}
vector[M] tmp[N]
Jonah