I am stuck in a fix.
I want to sample a covariance matrix \Sigma_e.
So, I am using Inv-Wishart distribution to sample \Sigma_e using scale matrix \Lambda and degree of freedom v. And then use this covariance matrix \Sigma_e as a parameter in Multivariate normal distribution.
Everything works fine if the dimension of the covariance matrix is small e.g., ten or less, but if the dimension of the matrix is large, e.g., 11 or more.
The model does not fit properly and shows fitting errors.
Can anyone help me understand what is happening and how could I fix it?
sigma_err ~ inv_wishart(sigma_error_dof, diag_matrix(rep_vector(sigma_error_variance,N))); count ~ multi_normal(count_hat, sigma_err);
this is the error that i am getting:
Exception: inv_wishart_lpdf: LDLT_Factor of random variable is not positive definite. last conditional variance is -4.44089e-16.