epinowcast
Loading...
Searching...
No Matches
expected_obs.stan
Go to the documentation of this file.
1
101
vector
expected_obs
(
102
real tar_obs, vector lh,
int
l,
int
ref_as_p,
int
rep_agg_p,
103
array[]
int
n_selected, array[,]
int
selected_idx
104
) {
105
vector[l] p;
106
if
(ref_as_p == 1) {
107
p = lh;
108
}
else
{
109
profile(
"model_likelihood_expected_obs_inv_logit"
) {
110
p = inv_logit(lh);
111
}
112
profile(
"model_likelihood_expected_obs_hazard_to_prob"
) {
113
p =
hazard_to_log_prob
(p, l);
114
}
115
}
116
if
(rep_agg_p == 1) {
117
vector[l] p_aggregated = rep_vector(negative_infinity(), l);
118
for
(i in 1:l) {
119
if
(n_selected[i] > 0) {
120
p_aggregated[i] = log_sum_exp(p[selected_idx[i, 1:n_selected[i]]]);
121
}
122
}
123
p = p_aggregated;
124
}
125
return
(tar_obs + p);
126
}
expected_obs
vector expected_obs(real tar_obs, vector lh, int l, int ref_as_p, int rep_agg_p, array[] int n_selected, array[,] int selected_idx)
Definition
expected_obs.stan:101
hazard_to_log_prob
vector hazard_to_log_prob(vector h, int l)
Definition
hazard.stan:78
functions
expected_obs.stan
Generated by
1.12.0