Skip to content

Commit 9b44f28

Browse files
authored
Antibody model fix (#27)
* swap antibody adjustment between infection/vaccination * perhaps better: let the model decide scaling * update prior
1 parent 0d21777 commit 9b44f28

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

R/model.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ i2p_data <- function(prev, ab, vacc, init_ab,
1212
prob_detectable, unobserved_time = 14, horizon = 0,
1313
inf_ab_delay = c(rep(0, 7 * 4), rep(1 / 7, 7)),
1414
vacc_ab_delay = c(rep(0, 7 * 4), rep(1 / 7, 7)),
15-
prop_dont_seroconvert = c(-2, 1), # 10%
15+
prop_seroconvert = c(2, 1), # 90%
1616
inf_waning_rate = c(-9, 4),
1717
vac_waning_rate = c(-9, 4), # 0.1%
1818
vaccine_efficacy = c(3, 1), # 95%
@@ -123,7 +123,7 @@ i2p_data <- function(prev, ab, vacc, init_ab,
123123
prob_detect_sd = rev(prob_detectable$sd),
124124
pbt = max(prob_detectable$time) + 1,
125125
init_inc_mean = logit(init_inc_mean),
126-
pbeta = prop_dont_seroconvert,
126+
pbeta = prop_seroconvert,
127127
pgamma_mean = c(inf_waning_rate[1], vac_waning_rate[1]),
128128
pgamma_sd = c(inf_waning_rate[2], vac_waning_rate[2]),
129129
pdelta = vaccine_efficacy,

stan/functions/ab.stan

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// @param vacc Vector of new vaccinations
66
//
7-
// @param beta Proportion (0 - 1) that don't seroconvert
7+
// @param beta Proportion (0 - 1) that seroconvert
88
//
99
// @param gamma Vector of daily rates of antibody waning (0 - 1) for both
1010
// infection and vaccination. Assumes to exponential waning.
@@ -21,22 +21,23 @@
2121
//
2222
// infections <- rep(0.01, 100)
2323
// vacc <- rep(0.001, 100)
24-
// beta <- 0.05
24+
// beta <- 0.95
2525
// gamma <- c(0.01, 0.001)
2626
// delta <- 0.9
2727
// init_pop_ab <- 0.2
2828
// t <- 100
2929
//
3030
// detectable_antibodies(infections, vacc, beta, gamma, delta, init_pop_ab, t)
3131
vector detectable_antibodies(vector infections, vector vacc,
32-
real beta, vector gamma, real delta, real init_pop_ab, int t) {
32+
real beta, vector gamma, real delta, real k, real l,
33+
real init_pop_ab, int t) {
3334
vector[t] pop_ab;
3435
vector[t] inf_ab;
3536
vector[t] vac_ab;
3637

3738
// Infection antibodies (assumes all previous from infection)
3839
inf_ab[1] = init_pop_ab // initial antibodies
39-
+ (1 - beta) * infections[1] * (1 - init_pop_ab) // new seroconversion
40+
+ beta * infections[1] // new seroconversion
4041
- init_pop_ab * gamma[1];
4142
// Vaccination antibodies
4243
vac_ab[1] = delta * vacc[1]; // vaccination
@@ -45,11 +46,11 @@ vector detectable_antibodies(vector infections, vector vacc,
4546
for (i in 2:t) {
4647
// Infection antibodies
4748
inf_ab[i] = inf_ab[i - 1]
48-
+ (1 - beta) * infections[i] * (1 - pop_ab[i - 1]) // new seroconversion
49+
+ beta * infections[i] * pow(1 - pop_ab[i - 1], k) // new seroconversion
4950
- inf_ab[i - 1] * gamma[1]; // waning
5051
// Vaccination antibodies
5152
vac_ab[i] = vac_ab[i - 1]
52-
+ delta * vacc[i] // new seroconversion
53+
+ delta * vacc[i] * pow(1 - pop_ab[i - 1], l) // new seroconversion
5354
- vac_ab[i - 1] * gamma[2]; // vaccination waning
5455
// Population antibodies
5556
pop_ab[i] = inf_ab[i] + vac_ab[i];

stan/inc2prev.stan

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ parameters {
7272
vector<lower = 0, upper = 1>[ab_obs ? 2 : 0] gamma; // antibody waning (inf & vac)
7373
vector<lower = 0, upper = 1>[ab_obs ? 1 : 0] delta; // vaccine efficacy
7474
vector<lower = 0, upper = 1>[ab_obs ? 1 : 0] init_dab; // initial proportion with antibodies
75+
vector<lower = 0>[n_ab > 0 ? 1 : 0] k; // Potential loss of efficacy from new infections in already seropositive people
76+
vector<lower = 0>[n_ab > 0 ? 1 : 0] l; // Potential loss of efficacy from new doses being administered to already seropositive people
7577
}
7678

7779
transformed parameters {
@@ -110,7 +112,7 @@ transformed parameters {
110112
infs_with_potential_abs = convolve(infections, inf_ab_delay);
111113
// calculate detectable antibodies
112114
dab = detectable_antibodies(infs_with_potential_abs, vacc_with_ab, beta[1],
113-
gamma, delta[1], init_dab[1], t);
115+
gamma, delta[1], k[1], l[1], init_dab[1], t);
114116
// calculate observed detectable antibodies
115117
odab = observed_in_window(dab, ab_stime, ab_etime, ut, ab_obs);
116118
//combined standard error

0 commit comments

Comments
 (0)