@@ -76,7 +76,9 @@ transformed data {
7676 }
7777 }
7878 sigma_base[1 ] = 0 ;
79- sigma_base[2 : L] = sigma0;
79+ for (l in 2 : L) {
80+ sigma_base[l] = sigma0[l- 1 ];
81+ }
8082
8183 // differentiate free kappa and fixed kappa
8284 for (l in 1 : (L- 2 )) {
@@ -231,14 +233,6 @@ model {
231233 }
232234 sa_hat[L] = sa[L] + exp( omega[i,L- 1 ]);
233235
234- // Response model (volatility-dependent stochasticity)
235- if (! input_first) {
236- // make choice based on previous valid input or inital prior belief
237- real zeta = exp( - mu_hat[3 ]);
238- real eta = zeta * mu_hat[2 ];
239- y[i,bIdx,t] ~ bernoulli_logit (eta);
240- }
241-
242236 sa_prev = sa;
243237
244238 // Level 2
@@ -276,7 +270,12 @@ model {
276270 }
277271
278272 // Response model (volatility-dependent stochasticity)
279- if (input_first) {
273+ if (! input_first) {
274+ // make choice based on previous valid input or inital prior belief
275+ real zeta = exp( - mu_hat[3 ]);
276+ real eta = zeta * mu_hat[2 ];
277+ y[i,bIdx,t] ~ bernoulli_logit (eta);
278+ } else {
280279 // make choice based on current input
281280 real zeta = exp( - mu[3 - 1 ]);
282281 real eta = zeta * mu[2 - 1 ];
@@ -329,14 +328,6 @@ generated quantities {
329328 }
330329 sa_hat[L] = sa[L] + exp( omega[i,L- 1 ]);
331330
332- // Response model (volatility-dependent stochasticity)
333- if (! input_first) {
334- // make choice based on previous valid input or inital prior belief
335- real zeta = exp( - mu_hat[3 ]);
336- real eta = zeta * mu_hat[2 ];
337- log_lik + = bernoulli_logit_lpmf( y[i,bIdx,t] | eta);
338- }
339-
340331 sa_prev = sa;
341332
342333 // Level 2
@@ -374,7 +365,12 @@ generated quantities {
374365 }
375366
376367 // Response model (volatility-dependent stochasticity)
377- if (input_first) {
368+ if (! input_first) {
369+ // make choice based on previous valid input or inital prior belief
370+ real zeta = exp( - mu_hat[3 ]);
371+ real eta = zeta * mu_hat[2 ];
372+ log_lik + = bernoulli_logit_lpmf( y[i,bIdx,t] | eta);
373+ } else {
378374 // make choice based on current input
379375 real zeta = exp( - mu[3 - 1 ]);
380376 real eta = zeta * mu[2 - 1 ];
0 commit comments