Hi,
I am receiving an Informational message that the scale parameter is not symmetric and that the covariance matrix is not symmetric. It looks like this the warning ( the code works fine) as below.
I am using symmetric matrices as you will see below in the initial values setting.
Any idea?
Warning Message
Exception: inv_wishart_lpdf: scale parameter is not symmetric. scale parameter[2,3] = -1.33734e-09, but scale parameter[3,2] = -1.13908e-08 (in
If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Exception: multi_normal_lpdf: Covariance matrix is not symmetric. Covariance matrix[1,2] = 1.27815e-08, but Covariance matrix[2,1] = 2.29241e-08
Stan Code
data {
int<lower=0> N;
vector[16] x;
matrix[N,16] y;
}
parameters {
vector[N] D;
vector[N] S0 ;
vector[N] f;
vector[N] Dstar;
real <lower=0> sigma;
vector[3] mu;
matrix[3,3] Sigma;
vector[3] mu_hyper;
matrix[3,3] Sigma_hyper;
real<lower=2> df_Sigma_hyper;
matrix[3,3] Psi_Sigma_hyper;
}
model {
for (n in 1:N){
S0[n] ~ uniform(50, 250);
matrix[n,3] theta;
theta[n,1] = D[n];
theta[n,2] = Dstar[n];
theta[n,3] = f[n];
theta[n] ~ multi_normal(mu, Sigma);
}
sigma ~ uniform(0,10);
mu ~ multi_normal(mu_hyper, Sigma_hyper);
Sigma ~ inv_wishart(df_Sigma_hyper, Psi_Sigma_hyper);
for (n in 1:N){
for (k in 1:16){
y[n,k] ~ normal(S0[n]*((1-f[n])*exp(-D[n]*x[k])+f[n]*exp(-Dstar[n]*x[k])),sigma);
}
}
}
My initial values are as below :
mu, zeros(3, 1)
Sigma, (diag([1e-3, 1e-3, 1e-3])+diag([1e-3, 1e-3, 1e-3])‘) / 2
mu_hyper, zeros(3, 1)
Sigma_hyper, (diag([1e3, 1e3, 1e3])+diag([1e3, 1e3, 1e3])’) / 2
Psi_Sigma_hyper’,(diag([1e3, 1e3, 1e3])+diag([1e3, 1e3, 1e3])‘) / 2
df_Sigma_hyper’, 3