50 matrix lexp_latent_int, vector r, array[]
int r_g,
int r_t,
51 int r_seed,
int gt_n, vector lrgt,
int t,
int g
53 array[g] vector[t] exp_lobs;
54 vector[gt_n] rgt = exp(lrgt);
57 vector[r_t] local_r = segment(r, r_g[k] + 1, r_t);
59 exp_lobs[k][1] = lexp_latent_int[1, k];
60 exp_lobs[k][(r_seed + 1):t] = exp_lobs[k][1] + cumulative_sum(local_r);
63 exp_obs[1:r_seed] = exp(lexp_latent_int[1:r_seed, k]);
64 vector[r_t] local_R = exp(local_r);
66 exp_obs[r_seed + i] = local_R[i] * dot_product(
67 segment(exp_obs, r_seed + i - gt_n, gt_n), rgt
70 exp_lobs[k] = log(exp_obs);
array[] vector log_expected_latent_from_r(matrix lexp_latent_int, vector r, array[] int r_g, int r_t, int r_seed, int gt_n, vector lrgt, int t, int g)