Hi everyone,
I am working to develop a model for counts of sampled individuals surviving a pesticide application with increasing doses. The model also accounts for differing survival rates to the pesticide based on three genotypes (AA, Aa, aa) that are expressed in different proportions of the population. I’ve attached the R script and data, and included the model below:
data {
int<lower=0> n_obs;
// vector[n_obs] dose;
// vector[n_obs] n_alive;
// vector[n_obs] n_tested;
real dose[n_obs];
int n_alive[n_obs];
int n_tested[n_obs];
}
parameters {
// background survival rate
real<lower=0> S_0;
// population parameter
real p_pop;
// genotype-specific mortality rates (per capita, per dose)
vector<lower=0>[n_obs] r_AA;
vector<lower=0>[n_obs] r_Aa;
vector<lower=0>[n_obs] r_aa;
}
model {
// proportion of population with genotype
real P_AA_pop;
real P_Aa_pop;
real P_aa_pop;
// survival probabilities based on genotype and dose
vector[n_obs] S_AA;
vector[n_obs] S_Aa;
vector[n_obs] S_aa;
// average survival probability of tested individuals
vector[n_obs] S_bar;
// priors
S_0 ~ beta(0.5, 0.5);
p_pop ~ beta(0.5, 0.5);
log(r_AA) ~ cauchy(0, 1);
log(r_Aa) ~ cauchy(0, 1);
log(r_aa) ~ cauchy(0, 1);
// target += -log(r_AA);
// target += -log(r_Aa);
// target += -log(r_aa);
// proportion of population with genotype
P_AA_pop = p_pop^2;
P_Aa_pop = 2*p_pop*(1 - p_pop);
P_aa_pop = (1 - p_pop)^2;
// survival to exposure based on genotype and dose
for (i in 1:n_obs){
S_AA = S_0*exp(-r_AA*dose[i]);
S_Aa = S_0*exp(-r_Aa*dose[i]);
S_aa = S_0*exp(-r_aa*dose[i]);
}
// average survival probability of tested individuals
S_bar = S_AA*P_AA_pop + S_Aa*P_Aa_pop + S_aa*P_aa_pop;
// likelihood
for (i in 1:n_obs){
n_alive[i] ~ binomial(n_tested[i], S_bar);
}
}
While I have gotten this model to run, I receive a large number of warnings about convergence issues which are not fixed by following the linked suggestions in the warning. Suspecting that the issue may be due to the log-transformed r_AA parameters, I’ve also tried the suggestions linked here, but encountered the same warnings from Stan.
I am not a proficient/advanced Stan user, so maybe I am missing something. Any suggestions on how to reformulate the model for improved inference would be much appreciated. Thank you!
analysis.R (1.8 KB)
pop_data.csv (531 Bytes)