Hi all,
I have an issue regarding the initializing parameters in Matlab.
My parameter is x which is bivariate normal distribution and i want the x[1] and x[2] both start from zero.
Regarding the Stan guideline about initialing parameters: https://github.com/brian-lau/MatlabStan/wiki/Initializing-parameters, I defined my parameters with the same format as the guideline’s example but the x[1] and x[2] never start from a value even close to zero (both start from a value close to 4).
Honestly, I don’t know what my problem is.
I would gratefully appreciate it if you could help me out in this regard.
I attach my Matab and Stan code via this post.
Thank you very much in advance for your consideration.
Hamed
Matlab code:
muf = zeros(1,2);
SIGMAf = eye(2);
dat = struct('mu',muf,'Sigma',SIGMAf);
params = struct('file','ConvLimSt.stan','data',dat,'chains',5,'iter',...
1000,'warmup', 20,'algorithm','NUTS','inc_warmup',true,'verbose',true);
fit = stan(params,'init',0);
Stan code: ConvLimSt.stan
data{
vector[2] mu;
matrix[2, 2] Sigma;
}
parameters {
vector[2] x;
}
transformed parameters {
real g = 0.1*(x[1] - x[2])^2 - ((1/sqrt(2))*(x[1] + x[2])) + 4.5;
}
model {
//prior
x ~ multi_normal(mu, Sigma);
//likelihood
target += normal_lpdf(g | 0,0.15);
}