I am following a Bayesian Learning Model, where consumers are assumed to hold some beliefs, and updated their beliefs as a Bayesian learner. At each decision point, they make decisions based on their beliefs.
The model has the following hierarchy:
where Q_ijt represents the mean of the belief distribution which follows a normal distribution. The issue here is that at any point of time t is Q_ijt unobserved. The typical MLE approach is to simulate Q_ijt, using simulated maximum likelihood. I wonder in the Bayesian approach, how should I deal with Q_ijt (how to construct the hierarchy)? Should I also use simulated data as data augmentation and then for each individual, compute the mean likelihood and add to the target+? or using transformed data/parameters?
parameters{
real<lower=0> M;
real<lower=0> V;
}
transformed parameters {
array[nupdt] real Mit; // this is the unobserved parameter
}
model{
M ~ uniform(1,4);
V ~ uniform(1,4);
int ob;
ob=0;
int upt;
upt = 0;
for (i in 1:ncust){
int start_i;int end_i;int count_i;
real mit0;real vit0;
real mit1;real vit1;
real mit_bar;real vit_bar;
start_i = start[i];
end_i = end[i];
count_i = count[i];
mit0 = 0.5;
vit0 = 5;
for (t in 1:count_i){
ob +=1;
int ini_it;
int com_it;
ini_it = Initiated[ob];
com_it = Completed[ob];
if (ini_it==1){
upt +=1;
vit1 = 1/(1/vit0 + ini_it/V);
vit_bar=ini_it*vit1^2/V;
mit_bar = vit1/vit0*mit0+ini_it*vit1/V*M;
com_it ~ bernoulli_logit(M);
Mit[upt] ~ normal(mit_bar,vit_bar); //add the hierarchy by assuming a normal distribution
} else{
vit1 = vit0;
mit1 = mit0;
}
ini_it ~ bernoulli_logit(Mit[upt]);
mit0 = Mit[upt];
vit0 = vit1;
}
}
}
currently, I specify M_it (which is the Q_ijt) as transformed parameters, and then in model block, I specified the normal distribution. However, when I run this, it gives me the following error:
Chain [1] Rejecting initial value:
Chain [1] Error evaluating the log probability at the initial value.
Chain [1] Exception: normal_lpdf: Random variable is nan, but must be not nan! (in ‘het0804_2 copy.stan’, line 65, column 20 to column 55)
What should I do with this?
Thank you very much for your help!