epinowcast
Loading...
Searching...
No Matches
log_expected_obs_from_latent.stan
Go to the documentation of this file.
1
51 array[] vector exp_llatent, int rd_n, vector w, array[] int v,
52 array[] int u, int t,
53 int g, vector latent_obs_prop
54) {
55 array[g] vector[t] exp_lobs;
56 int ft = t + rd_n - 1;
57 for (k in 1:g) {
58 if (rd_n == 1) {
59 exp_lobs[k] = exp_llatent[k] + log(w) +
60 segment(latent_obs_prop, (k-1) * t + 1, t);
61 } else {
62 vector[ft] exp_obs = csr_matrix_times_vector(
63 ft, ft, w, v, u, exp(exp_llatent[k])
64 );
65 exp_lobs[k] = log(exp_obs[rd_n:ft]) +
66 segment(latent_obs_prop, (k-1) * t + 1, t);
67 }
68
69 }
70 return(exp_lobs);
71}
array[] vector log_expected_obs_from_latent(array[] vector exp_llatent, int rd_n, vector w, array[] int v, array[] int u, int t, int g, vector latent_obs_prop)