Description Usage Arguments Details Value Examples
Fit an extended state-space SIR model being reduced by in-home hospitalization.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | qh.eSIR(
Y,
R,
phi0 = NULL,
change_time = NULL,
begin_str = "01/13/2020",
T_fin = 200,
nchain = 4,
nadapt = 10000,
M = 500,
thn = 10,
nburnin = 200,
dic = FALSE,
death_in_R = 0.02,
casename = "qh.eSIR",
beta0 = 0.2586,
gamma0 = 0.0821,
R0 = beta0/gamma0,
gamma0_sd = 0.1,
R0_sd = 1,
file_add = character(0),
add_death = FALSE,
save_files = FALSE,
save_mcmc = FALSE,
save_plot_data = FALSE,
eps = 1e-10
)
|
Y |
the time series of daily observed infected compartment proportions. |
R |
the time series of daily observed removed compartment proportions, including death and recovered. |
phi0 |
a vector of values of the dirac delta function φ_t. Each entry denotes the proportion that will be qurantined at each change time point. Note that all the entries lie between 0 and 1, its default is |
change_time |
the change points over time corresponding to |
begin_str |
the character of starting time, the default is "01/13/2020". |
T_fin |
the end of follow-up time after the beginning date |
nchain |
the number of MCMC chains generated by |
nadapt |
the iteration number of adaptation in the MCMC. We recommend using at least the default value 1e4 to obtained fully adapted chains. |
M |
the number of draws in each chain, with no thinning. The default is M=5e2 but suggest using 5e5. |
thn |
the thinning interval between mixing. The total number of draws thus would become |
nburnin |
the burn-in period. The default is 2e2 but suggest 2e5. |
dic |
logical, whether compute the DIC (deviance information criterion) for model selection. |
death_in_R |
the numeric value of average of cumulative deaths in the removed compartments. The default is 0.4 within Hubei and 0.02 outside Hubei. |
casename |
the string of the job's name. The default is "qh.eSIR". |
beta0 |
the hyperparameter of average transmission rate, the default is the one estimated from the SARS first-month outbreak (0.2586). |
gamma0 |
the hyperparameter of average removed rate, the default is the one estimated from the SARS first-month outbreak (0.0821). |
R0 |
the hyperparameter of the mean reproduction number R0. The default is thus the ratio of |
gamma0_sd |
the standard deviation for the prior distrbution of the removed rate γ, the default is 0.1. |
R0_sd |
the standard deviation for the prior disbution of R0, the default is 1. |
file_add |
the string to denote the location of saving output files and tables. |
add_death |
logical, whether add the approximate death curve to the plot, default is false. |
save_files |
logical, whether to save plots to file. |
save_mcmc |
logical, whether save ( |
save_plot_data |
logical, whether save the plotting data or not. |
eps |
a non-zero controller so that all the input |
In this function we allow it to characterize time-varying proportions of susceptible due to government-enforced stringent in-home isolation. We expanded the SIR model by adding a quarantine compartment with a time-varying rate of quarantine φ_t, the chance of a susceptible person being willing to take in-home isolation at time t.
casename |
the predefined |
incidence_mean |
mean cumulative incidence, the mean prevalence of cumulative confirmed cases at the end of the study. |
incidence_ci |
2.5%, 50%, and 97.5% quantiles of the incidences. |
out_table |
summary tables including the posterior mean of the prevalence processes of the 3 states compartments (θ_t^S,θ_t^I,θ_t^R,θ_t^H) at last date of data collected ((t^\prime) decided by the lengths of your input data |
plot_infection |
plot of summarizing and forecasting for the infection compartment, in which the vertical blue line denotes the last date of data collected (t^\prime), the vertical darkgray line denotes the deacceleration point (first turning point) that the posterior mean first-derivative of infection prevalence \dot{θ}_t^I achieves the maximum, the vertical purple line denotes the second turning point that the posterior mean first-derivative infection proportion \dot{θ}_t^I equals zero, the darkgray line denotes the posterior mean of the infection prevalence θ_t^I and the red line denotes its posterior median. |
plot_removed |
plot of summarizing and forecasting for the removed compartment with lines similar to those in the |
spaghetti_plot |
20 randomly selected MCMC draws of the first-order derivative of the posterior prevalence of infection, namely \dot{θ}_t^I. The black curve is the posterior mean of the derivative, and the vertical lines mark times of turning points corresponding respectively to those shown in |
first_tp_mean |
the date t at which \ddot{θ}_t^I=0, calculated as the average of the time points with maximum posterior first-order derivatives \dot{θ}_t^I; this value may be slightly different from the one labeled by the "darkgreen" lines in the two plots |
first_tp_mean |
the date t at which \ddot{θ}_t^I=0, calculated as the average of the time points with maximum posterior first-order derivatives \dot{θ}_t^I; this value may be slightly different from the one labeled by the "darkgreen" lines in the two plots |
first_tp_ci |
fwith |
second_tp_mean |
the date t at which θ_t^I=0, calculated as the average of the stationary points of all of posterior first-order derivatives \dot{θ}_t^I; this value may be slightly different from the one labeled by the "pruple" lines in the plots of |
second_tp_ci |
with |
dic_val |
the output of |
gelman_diag_list |
Since version 0.3.3, we incorporated Gelman And Rubin's Convergence Diagnostic using |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ## Not run:
NI_complete <- c(
41, 41, 41, 45, 62, 131, 200, 270, 375, 444, 549, 729,
1052, 1423, 2714, 3554, 4903, 5806, 7153, 9074, 11177,
13522, 16678, 19665, 22112, 24953, 27100, 29631, 31728, 33366
)
RI_complete <- c(
1, 1, 7, 10, 14, 20, 25, 31, 34, 45, 55, 71, 94, 121, 152, 213,
252, 345, 417, 561, 650, 811, 1017, 1261, 1485, 1917, 2260,
2725, 3284, 3754
)
N <- 58.5e6
R <- RI_complete / N
Y <- NI_complete / N - R # Jan13->Feb 11
change_time <- c("01/23/2020", "02/04/2020", "02/08/2020")
phi0 <- c(0.1, 0.4, 0.4)
res.q <- qh.eSIR(Y, R,
begin_str = "01/13/2020", death_in_R = 0.4,
phi0 = phi0, change_time = change_time,
casename = "Hubei_q", save_files = T, save_mcmc = F,
M = 5e2, nburnin = 2e2
)
res.q$plot_infection
# res.q$plot_removed
res.noq <- qh.eSIR(Y, R,
begin_str = "01/13/2020", death_in_R = 0.4,
T_fin = 200, casename = "Hubei_noq",
M = 5e2, nburnin = 2e2
)
res.noq$plot_infection
## End(Not run)
change_time <- c("01/16/2020")
phi0 <- c(0.1)
NI_complete2 <- c(41, 45)
RI_complete2 <- c(1, 1)
N2 <- 1E3
res2 <- qh.eSIR(
RI_complete2 / N2,
NI_complete2 / N2,
begin_str = "01/13/2020",
T_fin = 4,
phi0 = phi0,
change_time = change_time,
dic = FALSE,
casename = "Hubei_q",
save_files = FALSE,
save_mcmc = FALSE,
save_plot_data = FALSE,
M = 50,
nburnin = 1
)
closeAllConnections()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.