model {
exp_subclinical[1] ~ uniform(1,upper_lambda1);
for( oy in 2:n_years ){
exp_subclinical[oy] ~ gamma(exp_subc_k, exp_subc_k/exp_subclinical[oy-1]);
}
...
}...When I am running the model I get Metropolis proposals rejected because of:I don't understand how the inverse scale parameter can become negative, being the division of a positive value by a value which is either from a uniform(1,some positive value I supplied) or a gamma distribution.
Exception thrown at line 104: stan::math::gamma_log: Inverse scale parameter is -61.6392, but must be > 0!
parameters {
...
real exp_subclinical[n_years];
...
}
model {
exp_subclinical[1] ~ uniform(1,upper_lambda1);
for( oy in 2:n_years ){
exp_subclinical[oy] ~ gamma(exp_subc_k, exp_subc_k/exp_subclinical[oy-1]);
}
...
}
Exception thrown at line 104: stan::math::gamma_log: Inverse scale parameter is -61.6392, but must be > 0!
Actually I think I will do that now.
The problem wasn't an undefined variable, but a lack of constraint
in a parameter declaration:
Do you think having them write this:
target += uniform_lpdf(exp_subclinical[1] | 1, upper_lambda1);
for (oy in 2:n_years)
target += gamma_lpdf(exp_subclinical[oy] | exp_subc_k,
exp_subc_k / exp_subclinical[oy-1]);
would've made it clear to them that their variable needed
a constraint?