Skip to content

Update phi parameterisation #487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 25, 2023
Next Next commit
Update observation_model.stan
  • Loading branch information
seabbs authored Oct 24, 2023
commit 85d5563015004d1ba4c97b5d905887083e71a37d
6 changes: 3 additions & 3 deletions inst/stan/functions/observation_model.stan
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void report_lp(array[] int cases, vector reports,
if (model_type) {
real sqrt_phi; // the reciprocal overdispersion parameter (phi)
rep_phi[model_type] ~ normal(phi_mean, phi_sd) T[0,];
sqrt_phi = 1 / sqrt(rep_phi[model_type]);
sqrt_phi = 1 / pow(rep_phi[model_type], 2);
if (weight == 1) {
cases ~ neg_binomial_2(reports, sqrt_phi);
} else {
Expand All @@ -83,7 +83,7 @@ vector report_log_lik(array[] int cases, vector reports,
log_lik[i] = poisson_lpmf(cases[i] | reports[i]) * weight;
}
} else {
real sqrt_phi = 1 / sqrt(rep_phi[model_type]);
real sqrt_phi = 1 / pow(rep_phi[model_type], 2);
for (i in 1:t) {
log_lik[i] = neg_binomial_2_lpmf(cases[i] | reports[i], sqrt_phi) * weight;
}
Expand All @@ -96,7 +96,7 @@ array[] int report_rng(vector reports, array[] real rep_phi, int model_type) {
array[t] int sampled_reports;
real sqrt_phi = 1e5;
if (model_type) {
sqrt_phi = 1 / sqrt(rep_phi[model_type]);
sqrt_phi = 1 / pow(rep_phi[model_type], 2);
}

for (s in 1:t) {
Expand Down