Skip to content

Commit

Permalink
Revert "Testing slightly different viral kinetics curve"
Browse files Browse the repository at this point in the history
This reverts commit 7ccaf24.
  • Loading branch information
jameshay218 committed May 20, 2021
1 parent 7ccaf24 commit 8ad1e19
Show file tree
Hide file tree
Showing 31 changed files with 55 additions and 89 deletions.
2 changes: 1 addition & 1 deletion 1.nursing_homes/1.nursing_home_analyses_combined.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ setwd(main_wd)

## IMPORTANT - change this flag to TRUE if running the MCMC for the first time
rerun_mcmc_seeirr <- FALSE
rerun_mcmc_ct <- TRUE
rerun_mcmc_ct <- FALSE

## Clean data and set up model parameters. Also some data plots.
source("1.nursing_homes/1.nursing_home_analyses_headers.R")
Expand Down
8 changes: 4 additions & 4 deletions 5.bwh/5.fit_ma_gp.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ devtools::load_all(paste0(HOME_WD,"/virosolver"))
index <- 1994
set.seed(index)
n_samp <- 1000
runname <- "ma_gp_test"
runname <- "ma_gp"
#runname <- "ma_gp_free"
run_version <- "gp" ##gp, seir or exp##
rerun_mcmc <- TRUE
rerun_mcmc <- FALSE

## CHANGE TO MAIN WD
## Important to set this to the full file path, as on L205 the foreach loop
Expand Down Expand Up @@ -231,7 +231,7 @@ for(ii in seq_along(samps)){
tmp_pars <- get_index_pars(chain_comb, samps[ii])
vl <- viral_load_func(tmp_pars,test_ages,FALSE)
vl_trajs[ii,] <- extraDistr::rgumbel(length(vl),vl,tmp_pars["obs_sd"])
detect_trajs[ii,] <- c(0,prop_detectable(test_ages[test_ages > 0], tmp_pars, vl[test_ages > 0]))
detect_trajs[ii,] <- c(0,prop_detectable(test_ages[test_ages > 0], tmp_pars, vl))
trajs[ii,] <- pmax(smooth.spline(inc_func_use(tmp_pars,times))$y,0.0000001)
#trajs[ii,] <- pmax(inc_func_use(get_index_pars(chain_comb, samps[ii]),times),0.0000001)
}
Expand Down Expand Up @@ -391,7 +391,7 @@ p_inc <- ggplot(trajs_quants) +
export_theme +
ylab("Relative probability of infection") +
xlab("Date") +
#scale_x_date(limits=as.Date(c("2020-03-01","2020-12-01")),breaks="1 month",expand=c(0,0)) +
scale_x_date(limits=as.Date(c("2020-03-01","2020-12-01")),breaks="1 month",expand=c(0,0)) +
#coord_cartesian(ylim=c(-0.0001,0.005)) +
scale_y_continuous(expand=c(0,0)) +
labs(tag="C")
Expand Down
2 changes: 1 addition & 1 deletion 5.bwh/5.fit_ma_single_timepoints_exp.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ devtools::load_all(paste0(HOME_WD,"lazymcmc"))
## Arguments for this run
set.seed(1)
n_samp <- 1000
runname <- "ma_exp_test"
runname <- "ma_exp"
run_version <- "exp" ##gp, seir or exp##

## IMPORTANT - change this flag to TRUE if running the MCMC for the first time
Expand Down
2 changes: 1 addition & 1 deletion 5.bwh/5.fit_ma_single_timepoints_seir.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ devtools::load_all(paste0(HOME_WD,"lazymcmc"))
## Arguments for this run
set.seed(1)
n_samp <- 1000
runname <- "ma_seir_test"
runname <- "ma_seir_exposed_seed"
run_version <- "seir" ##gp, seir or exp##

## IMPORTANT - change this flag to TRUE if running the MCMC for the first time
Expand Down
6 changes: 3 additions & 3 deletions 5.bwh/Figure4.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ obs_times <- c(35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126,
seir_timeshift <- 36

## Run names for the various MCMC chains
runname_seir <- "ma_seir_test" ## Constrained prior on seed time
runname_seir <- "ma_seir_constrained" ## Constrained prior on seed time
runname_seir_prior <- "ma_seir_prior_constrained"
runname_seir_prior_broad <- "ma_seir_rerun_prior"
runname_seir_alt <- "ma_seir_rerun" ## Less constrained prior on seed time
runname_exp <- "ma_exp_test"
runname_exp <- "ma_exp"

## Where the MCMC chains are stored
chainwd <- paste0("~/Documents/GitHub/virosolver_paper/mcmc_chains/5.real_ma_single_timepoint/")
chainwd_gp <- paste0("~/Documents/GitHub/virosolver_paper/mcmc_chains/4.real_ma_ct/ma_gp_test/")
chainwd_gp <- paste0("~/Documents/GitHub/virosolver_paper/mcmc_chains/4.real_ma_ct/ma_gp/")

## MCMC parameters for Ct model fits
mcmcPars_ct_seir <- c("adaptive_period"=30000)
Expand Down
Binary file removed figures/Figure2.pdf
Binary file not shown.
Binary file removed figures/Figure2.png
Binary file not shown.
Binary file removed figures/ma_gp_test.pdf
Binary file not shown.
Binary file removed figures/supplement/FigureS4_a.pdf
Binary file not shown.
Binary file removed figures/supplement/FigureS4_a.png
Binary file not shown.
Binary file removed figures/supplement/FigureS4_b.pdf
Binary file not shown.
Binary file removed figures/supplement/FigureS4_b.png
Binary file not shown.
Binary file removed figures/supplement/biobot.png
Binary file not shown.
Binary file modified figures/supplement/nh_data.pdf
Binary file not shown.
Binary file modified figures/supplement/nh_posteriors.pdf
Binary file not shown.
Binary file modified figures/supplement/nh_posteriors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed figures/supplement/seeirr_chains.pdf
Binary file not shown.
Binary file removed figures/supplement/viral_kinetics_bwh.pdf
Binary file not shown.
Binary file removed figures/supplement/viral_kinetics_bwh.png
Binary file not shown.
Binary file modified figures/supplement/viral_kinetics_nh.pdf
Binary file not shown.
Binary file modified figures/supplement/viral_kinetics_nh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions pars/massachusetts/partab_exp_model.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
values,names,fixed,lower_bound,upper_bound,steps,lower_start,upper_start
0.1,beta,0,-0.5,0.5,0.1,-0.2,0.2
1,overall_prob,0,0,1,0.1,0,1
1,tshift,1,0,3,0.1,0,10
0,tshift,1,0,3,0.1,0,10
5,desired_mode,1,0,7,0.1,0,10
21.56194409,viral_peak,0,0,40,0.1,15,25
6.195697774,obs_sd,0,0,25,0.1,1,10
0.636291677,sd_mod,1,0,1,0.1,0.4,0.6
19.73598747,viral_peak,0,0,40,0.1,15,25
5,obs_sd,0,0,25,0.1,1,10
0.788828786,sd_mod,1,0,1,0.1,0.4,0.6
14,sd_mod_wane,1,0,14,0.1,0,14
40,true_0,1,40,100,0.1,40,100
40,intercept,1,35,100,0.1,35,100
3,LOD,1,0,10,0.1,0,10
5,incu,1,0,10,0.1,0,10
13.72235562,t_switch,0,0,30,0.1,10,30
13.29211948,t_switch,0,0,30,0.1,10,30
38,level_switch,0,0,40,0.1,33,40
1000,wane_rate2,1,0,10000,0.1,10,50
0.123203205,prob_detect,0,0,1,0.1,0.01,0.1
0.103299323,prob_detect,0,0,1,0.1,0.01,0.1
1,t_unit,1,0,1,0.1,0,1
12 changes: 6 additions & 6 deletions pars/massachusetts/partab_exp_pos_model.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
values,names,fixed,lower_bound,upper_bound,steps,lower_start,upper_start
-0.1,beta,0,-0.5,0.5,0.1,-0.2,0.2
1,overall_prob,1,0,1,0.1,0,1
1,tshift,1,0,3,0.1,0,10
0,tshift,1,0,3,0.1,0,10
5,desired_mode,1,0,7,0.1,0,10
21.56194409,viral_peak,0,0,40,0.1,15,25
6.195697774,obs_sd,0,0,25,0.1,1,10
0.636291677,sd_mod,1,0,1,0.1,0.4,0.6
19.73598747,viral_peak,0,0,40,0.1,15,25
5,obs_sd,0,0,25,0.1,1,10
0.788828786,sd_mod,1,0,1,0.1,0.4,0.6
14,sd_mod_wane,1,0,14,0.1,0,14
40,true_0,1,40,100,0.1,40,100
40,intercept,1,35,100,0.1,35,100
3,LOD,1,0,10,0.1,0,10
5,incu,1,0,10,0.1,0,10
13.72235562,t_switch,0,0,30,0.1,10,30
13.29211948,t_switch,0,0,30,0.1,10,30
38,level_switch,0,0,40,0.1,33,40
1000,wane_rate2,1,0,10000,0.1,10,50
0.123203205,prob_detect,0,0,1,0.1,0.01,0.1
0.103299323,prob_detect,0,0,1,0.1,0.01,0.1
1,t_unit,1,0,1,0.1,0,1
12 changes: 6 additions & 6 deletions pars/massachusetts/partab_gp_model.csv
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
values,names,fixed,lower_bound,upper_bound,steps,lower_start,upper_start
0.5,overall_prob,0,0,1,0.1,0,1
1,tshift,1,0,3,0.1,0,10
0,tshift,1,0,3,0.1,0,10
5,desired_mode,1,0,7,0.1,0,10
21.56194409,viral_peak,0,0,40,0.1,15,25
6.195697774,obs_sd,0,0,25,0.1,1,10
0.636291677,sd_mod,1,0,1,0.1,0.4,0.6
19.73598747,viral_peak,0,0,40,0.1,15,25
5,obs_sd,0,0,25,0.1,1,10
0.788828786,sd_mod,1,0,1,0.1,0.4,0.6
14,sd_mod_wane,1,0,14,0.1,0,14
40,true_0,1,40,100,0.1,40,100
40,intercept,1,35,100,0.1,35,100
3,LOD,1,0,10,0.1,0,10
5,incu,1,0,10,0.1,0,10
13.72235562,t_switch,0,0,30,0.1,10,30
13.29211948,t_switch,0,0,30,0.1,10,30
38,level_switch,0,0,40,0.1,33,40
1000,wane_rate2,1,0,10000,0.1,10,50
0.123203205,prob_detect,0,0,1,0.1,0.01,0.1
0.103299323,prob_detect,0,0,1,0.1,0.01,0.1
1,t_unit,1,0,1,0.1,0,1
0,t0,1,0,100,0.1,0,50
1.5,nu,1,0,100,0.1,2,5
Expand Down
12 changes: 6 additions & 6 deletions pars/massachusetts/partab_seir_model.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
values,names,fixed,lower_bound,upper_bound,steps,lower_start,upper_start
1,tshift,1,0,3,0.1,0,10
0,tshift,1,0,3,0.1,0,10
5,desired_mode,1,0,7,0.1,0,10
21.56194409,viral_peak,0,0,40,0.1,15,25
6.195697774,obs_sd,0,0,25,0.1,1,10
0.636291677,sd_mod,1,0,1,0.1,0.4,0.6
19.73598747,viral_peak,0,0,40,0.1,15,25
5,obs_sd,0,0,25,0.1,1,10
0.788828786,sd_mod,1,0,1,0.1,0.4,0.6
14,sd_mod_wane,1,0,14,0.1,0,14
40,true_0,1,40,100,0.1,40,100
40,intercept,1,35,100,0.1,35,100
3,LOD,1,0,10,0.1,0,10
5,incu,1,0,10,0.1,0,10
13.72235562,t_switch,0,0,30,0.1,10,30
13.29211948,t_switch,0,0,30,0.1,10,30
38,level_switch,0,0,40,0.1,33,40
1000,wane_rate2,1,0,10000,0.1,10,50
0.123203205,prob_detect,0,0,1,0.1,0.01,0.1
0.103299323,prob_detect,0,0,1,0.1,0.01,0.1
1,t_unit,1,0,1,0.1,0,1
2.5,R0,0,1,10,0.1,1.5,3
4,infectious,0,0,25,0.1,5,10
Expand Down
12 changes: 6 additions & 6 deletions pars/nursing_homes/partab_exp_model.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
values,names,fixed,lower_bound,upper_bound,steps,lower_start,upper_start
0.1,beta,0,-0.5,0.5,0.1,-0.2,0.2
1,overall_prob,0,0,1,0.1,0,1
1,tshift,1,0,3,0.1,0,10
0,tshift,1,0,3,0.1,0,10
5,desired_mode,1,0,7,0.1,0,10
20.76267783,viral_peak,0,0,40,0.1,15,25
5.216597448,obs_sd,0,0,25,0.1,1,10
0.390277615,sd_mod,1,0,1,0.1,0.4,0.6
20.66182195,viral_peak,0,0,40,0.1,15,25
5.150558612,obs_sd,0,0,25,0.1,1,10
0.395291595,sd_mod,1,0,1,0.1,0.4,0.6
14,sd_mod_wane,1,0,14,0.1,0,14
40,true_0,1,40,100,0.1,40,100
40,intercept,1,35,100,0.1,35,100
3,LOD,1,0,10,0.1,0,10
5,incu,1,0,10,0.1,0,10
8.39345933,t_switch,0,0,30,0.1,10,30
9.383013136,t_switch,0,0,30,0.1,10,30
33,level_switch,0,0,40,0.1,33,40
1000,wane_rate2,1,0,10000,0.1,10,50
0.109859503,prob_detect,0,0,1,0.1,0.01,0.1
0.109940519,prob_detect,0,0,1,0.1,0.01,0.1
1,t_unit,1,0,1,0.1,0,1
12 changes: 6 additions & 6 deletions pars/nursing_homes/partab_exp_pos_model.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
values,names,fixed,lower_bound,upper_bound,steps,lower_start,upper_start
-0.1,beta,0,-0.5,0.5,0.1,-0.2,0.2
1,overall_prob,1,0,1,0.1,0,1
1,tshift,1,0,3,0.1,0,10
0,tshift,1,0,3,0.1,0,10
5,desired_mode,1,0,7,0.1,0,10
20.76267783,viral_peak,0,0,40,0.1,15,25
5.216597448,obs_sd,0,0,25,0.1,1,10
0.390277615,sd_mod,1,0,1,0.1,0.4,0.6
20.66182195,viral_peak,0,0,40,0.1,15,25
5.150558612,obs_sd,0,0,25,0.1,1,10
0.395291595,sd_mod,1,0,1,0.1,0.4,0.6
14,sd_mod_wane,1,0,14,0.1,0,14
40,true_0,1,40,100,0.1,40,100
40,intercept,1,35,100,0.1,35,100
3,LOD,1,0,10,0.1,0,10
5,incu,1,0,10,0.1,0,10
8.39345933,t_switch,0,0,30,0.1,10,30
9.383013136,t_switch,0,0,30,0.1,10,30
33,level_switch,0,0,40,0.1,33,40
1000,wane_rate2,1,0,10000,0.1,10,50
0.109859503,prob_detect,0,0,1,0.1,0.01,0.1
0.109940519,prob_detect,0,0,1,0.1,0.01,0.1
1,t_unit,1,0,1,0.1,0,1
12 changes: 6 additions & 6 deletions pars/nursing_homes/partab_seir_model.csv
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
values,names,fixed,lower_bound,upper_bound,steps,lower_start,upper_start
1,tshift,1,0,3,0.1,0,10
0,tshift,1,0,3,0.1,0,10
5,desired_mode,1,0,7,0.1,0,10
20.76267783,viral_peak,0,0,40,0.1,15,25
5.216597448,obs_sd,0,0,25,0.1,1,10
0.390277615,sd_mod,1,0,1,0.1,0.4,0.6
20.66182195,viral_peak,0,0,40,0.1,15,25
5.150558612,obs_sd,0,0,25,0.1,1,10
0.395291595,sd_mod,1,0,1,0.1,0.4,0.6
14,sd_mod_wane,1,0,14,0.1,0,14
40,true_0,1,40,100,0.1,40,100
40,intercept,1,35,100,0.1,35,100
3,LOD,1,0,10,0.1,0,10
5,incu,1,0,10,0.1,0,10
8.39345933,t_switch,0,0,30,0.1,10,30
9.383013136,t_switch,0,0,30,0.1,10,30
33,level_switch,0,0,40,0.1,33,40
1000,wane_rate2,1,0,10000,0.1,10,50
0.109859503,prob_detect,0,0,1,0.1,0.01,0.1
0.109940519,prob_detect,0,0,1,0.1,0.01,0.1
1,t_unit,1,0,1,0.1,0,1
2.5,R0,0,1,10,0.1,1.5,3
4,infectious,0,0,25,0.1,5,10
Expand Down
17 changes: 0 additions & 17 deletions pars/partab_fitted_bwh.csv

This file was deleted.

17 changes: 0 additions & 17 deletions pars/partab_fitted_nh.csv

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/a.fit_viral_load_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ targeted_dat <- tibble(age=ages_observed, prob=desired_probs)

pars_hinge2 <- parTab$values
names(pars_hinge2) <- parTab$names
pars_hinge2["tshift"] <- 1


######################################################
## COST FUNCTION
Expand Down Expand Up @@ -327,11 +327,11 @@ if(SAVE_PLOTS){
ggsave("figures/supplement/viral_kinetics_bwh.pdf",p_main,height=6,width=8)
ggsave("figures/supplement/viral_kinetics_bwh.png",p_main,height=6,width=8)
parTab$values <- pars1
write_csv(parTab,"pars/partab_fitted_bwh.csv")
#write_csv(parTab,"pars/partab_fitted_bwh.csv")
} else {
ggsave("figures/supplement/viral_kinetics_nh.pdf",p_main,height=6,width=8)
ggsave("figures/supplement/viral_kinetics_nh.png",p_main,height=6,width=8)
parTab$values <- pars1
write_csv(parTab,"pars/partab_fitted_nh.csv")
#write_csv(parTab,"pars/partab_fitted_nh.csv")
}
}

0 comments on commit 8ad1e19

Please sign in to comment.