Hi all,
I got some information messages when using the multi_normal_lpdf
function as the following,
Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Chain 4 Exception: multi_normal_lpdf: LDLT_Factor of covariance parameter is not positive definite. last conditional variance is nan.
,
Exception: Exception: multi_normal_lpdf: Covariance matrix is not symmetric.
, or
Exception: Exception: quad_form_sym: A is not symmetric. A[1,2] = nan, but A[2,1] = nan
I tried to tune the step_size parameter to .01 to fix the problem, and it can be fixed to some extent. But I still wonder what causes the problem.
The equation that I pass to the multi_normal_lpdf
function is as follows,
functions{
real mmn(real mu_intercept, real mu_slope, vector time_seg,
matrix Sigma, real sigma_e, vector y_seg){
vector[rows(time_seg)] mu_seg;
matrix[rows(time_seg),2] Z_j;
matrix[rows(time_seg),rows(time_seg)]Cov_j;
mu_seg = mu_intercept + (mu_slope)* time_seg;
Z_j = append_col(rep_vector(1.0, rows(time_seg)), time_seg);
Cov_j = quad_form_sym(Sigma, Z_j') + diag_matrix(rep_vector(sigma_e^2, rows(time_seg)));
return multi_normal_lpdf (y_seg| mu_seg, Cov_j);
}
}
Can anyone help me? I appreciate it very much.
Best wishes,
Doria