diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 8d460cb..fcbeedb 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-10-22T21:35:54","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-10-22T22:26:15","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index 48899b6..55b2eeb 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,3 +1,3 @@ HOME · UCIWWEIHR.jl

UCIWWEIHR.jl

Welcome to the UCIWWEIHR.jl package documentation! CURRENTLY UNDER DEVELOPMENT!!!

By : Christian O. Bernal Zelaya & Volodymyr M. Minin.

Introduction

UCIWWEIHR.jl is a Julia package for forecasting and nowcasting COVID-19 hospitalizations using pathogen genome concentrations. UCIWWEIHR.jl Package License

Features

  • Comprehensive library of Bayesian models
  • Simulation of infectious disease
  • Model calibration
  • Sensitivity analysis and uncertainty quantification?
  • Visualization of results and MCMC evaluations(live?)

Installation

To install UCIWWEIHR.jl, you can use the Julia package manager. Open the Julia REPL and run the following command:

using Pkg
-Pkg.add("https://github.com/cbernalz/UCIWWEIHR.jl.git")
+Pkg.add("https://github.com/cbernalz/UCIWWEIHR.jl.git") diff --git a/dev/license/index.html b/dev/license/index.html index d8aa20a..f456d5b 100644 --- a/dev/license/index.html +++ b/dev/license/index.html @@ -1,2 +1,2 @@ -LICENSE · UCIWWEIHR.jl

UCIWWEIHR.jl Package License

The UCIWWEIHR.jl package is licensed under the MIT License.

MIT License

MIT License

Copyright (c) 2024 Christian O. Bernal Zelaya

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+LICENSE · UCIWWEIHR.jl

UCIWWEIHR.jl Package License

The UCIWWEIHR.jl package is licensed under the MIT License.

MIT License

MIT License

Copyright (c) 2024 Christian O. Bernal Zelaya

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

diff --git a/dev/reference/index.html b/dev/reference/index.html index 3156edb..6b97088 100644 --- a/dev/reference/index.html +++ b/dev/reference/index.html @@ -1,4 +1,4 @@ -REFERENCE · UCIWWEIHR.jl

Reference

Contents

Index

UCIWWEIHR.uciwweihr_model_paramsType
uciwweihr_model_params

Struct for holding parameters used in the UCIWWEIHR ODE compartmental model. Use create_uciwweihr_model_params to create an instance of this struct.

Fields

  • E_init_sd::Float64=50.0: Standard deviation for the initial number of exposed individuals.
  • E_init_mean::Int64=200: Mean for the initial number of exposed individuals.
  • I_init_sd::Float64=20.0: Standard deviation for the initial number of infected individuals.
  • I_init_mean::Int64=100: Mean for the initial number of infected individuals.
  • H_init_sd::Float64=5.0: Standard deviation for the initial number of hospitalized individuals.
  • H_init_mean::Int64=20: Mean for the initial number of hospitalized individuals.
  • gamma_sd::Float64=0.02: Standard deviation for the rate of incubation.
  • log_gamma_mean::Float64=log(1/4): Mean for the rate of incubation on log scale.
  • nu_sd::Float64=0.02: Standard deviation for the rate of leaving the infected compartment.
  • log_nu_mean::Float64=log(1/7): Mean for the rate of leaving the infected compartment on the log scale.
  • epsilon_sd::Float64=0.02: Standard deviation for the rate of hospitalization recovery.
  • log_epsilon_mean::Float64=log(1/5): Mean for the rate of hospitalization recovery on the log scale.
  • rho_gene_sd::Float64=0.02: Standard deviation for the rho prior.
  • log_rho_gene_mean::Float64=log(0.011): Mean for the row prior on log scale.
  • sigma_wastewater::Float64=log(0.1): Standard deviation for the negative binomial distribution for wastewater data. Not infered.
  • sigma_hosp::Float64=500.0: Standard deviation for the negative binomial distribution for hospital data. Not infered.
  • Rt_init_sd::Float64=0.3: Standard deviation for the initial value of the time-varying reproduction number.
  • Rt_init_mean::Float64=0.2: Mean for the initial value of the time-varying reproduction number.
  • sigma_Rt_sd::Float64=0.2: Standard deviation for normal prior of log time-varying reproduction number standard deviation.
  • sigma_Rt_mean::Float64=-3.0: Mean for normal prior of log time-varying reproduction number standard deviation.
  • w_init_sd::Float64=0.1: Standard deviation for the initial value of the time-varying hospitalization rate.
  • w_init_mean::Float64=log(0.35): Mean for the initial value of the time-varying hospitalization rate.
  • sigma_w_sd::Float64=0.2: Standard deviation for normal prior of log time-varying hospitalization rate standard deviation.
  • sigma_w_mean::Float64=-3.5: Mean for normal prior of time-varying hospitalization rate standard deviation.
source
UCIWWEIHR.uciwweihr_sim_paramsType
uciwweihr_sim_params

Struct for holding parameters used in the UCIWWEIHR ODE compartmental model simulation. Use create_uciwweihr_sim_params to create an instance of this struct.

Fields

  • time_points::Int64: Number of time points for the simulation.
  • seed::Int64: Seed for random number generation.
  • E_init::Int64: Initial number of exposed individuals.
  • I_init::Int64: Initial number of infected individuals.
  • H_init::Int64: Initial number of hospitalized individuals.
  • gamma::Float64: Rate of incubation.
  • nu::Float64: Rate of leaving the infected compartment.
  • epsilon::Float64: Rate of hospitalization recovery.
  • rho_gene::Float64: Contribution of infected individual's pathogen genome into wastewater.
  • tau::Float64: Scale/variation of the log concentration of pathogen genome in wastewater.
  • df::Float64: Degrees of freedom for generalized t-distribution for log concentration of pathogen genome in wastewater.
  • sigma_hosp::Float64: Standard deviation for the negative binomial distribution for hospital data.
  • Rt::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying reproduction number.
  • sigma_Rt::Float64: Standard deviation for random walk of time-varying reproduction number.
  • w::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying hospitalization rate.
  • sigma_w::Float64: Standard deviation for random walk of time-varying hospitalization rate.
  • rt_init::Float64: Initial value of the time-varying reproduction number, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.
  • w_init::Float64: Initial value of the time-varying hospitalization rate, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.
source
UCIWWEIHR.ChainsCustomIndexMethod
ChainsCustomIndex(c::Chains, indices_to_keep::BitMatrix)

Reduce Chains object to only wanted indices.

Function created by Damon Bayer.

source
UCIWWEIHR.NegativeBinomial2Method

Create a re-parametrized negative binomial distribution in terms of mean and overdispersion.

Arguments

  • μ: Mean of the distribution.
  • ϕ: Overdispersion parameter.

Returns

A Distributions.NegativeBinomial distribution object.

source
UCIWWEIHR.calculate_quantilesMethod
calculate_quantiles(df, chain, var_prefix, quantiles)

Calculate quantiles for a given chain and variable prefix. Quantiles can be any user desired quantile.

source
UCIWWEIHR.create_uciwweihr_model_paramsMethod
create_uciwweihr_model_params(; kwargs...)

Creates a uciwweihr_sim_params struct with the option to either use a predetermined Rt and w or generate them as random walks.

Arguments

  • kwargs...: Named arguments corresponding to the fields in uciwweihr_sim_params.

Returns

  • params::uciwweihr_sim_params: A struct with simulation parameters.
source
UCIWWEIHR.create_uciwweihr_sim_paramsMethod

createuciwweihrsim_params(; kwargs...)

Creates a uciwweihr_sim_params struct with the option to either use a predetermined Rt and w or generate them as random walks.

Arguments

  • kwargs...: Named arguments corresponding to the fields in uciwweihr_sim_params.

Returns

  • params::uciwweihr_sim_params: A struct with simulation parameters.
source
UCIWWEIHR.eihr_ode!Method

eihr_ode!(du, u, p, t)

Calculate the ordinary differential equations (ODEs) for the EIHR model.

Parameters:

  • du: Array{Float64,1} - The derivative of the state variables.
  • u: Array{Float64,1} - The current state variables.
  • p: Tuple{Float64,Float64,Float64,Float64,Float64} - The model parameters (alpha, gamma, nu, w, epsilon).
  • t: Float64 - The current time.

Returns:

  • du: Array{Float64,1} - The derivative of the state variables.
source
UCIWWEIHR.generate_logit_normal_random_walkMethod
generate_logit_normal_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)

Generates a logit-normal random walk time series.

Arguments

  • time_points::Int64: Number of time points.
  • sigma::Float64: Standard deviation of the random walk in logit space.
  • init_val::Float64: Initial value of the random walk on the probability scale.

Returns

  • walk::Vector{Float64}: Generated random walk on the probability scale.
source
UCIWWEIHR.generate_random_walkMethod
generate_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)

Generates a random walk time series.

Arguments

  • time_points::Int64: Number of time points.
  • sigma::Float64: Standard deviation of the random walk.
  • init_val::Float64: Initial value of the random walk.

Returns

  • walk::Vector{Float64}: Generated random walk.
source
UCIWWEIHR.generate_simulation_data_agentFunction

Generating Simulation Data for Agent Based Model

To generate simulation data using the agent based model, you can use the generate_simulation_data_agent function defined in the UCIWWEIHR.jl package. This function allows you to customize various parameters for the simulation. NOT FINISHED, STILL NEEDS WW AND RT

Function Signature

Arguments

  • seed::Int64: Seed for random number generation. Default value is 1.
  • pop_size::Int64: Size of the population. Default value is 1000.
  • I_init::Int64: Initial number of infected individuals. Default value is 200.
  • H_init::Int64: Initial number of hospitalized individuals. Default value is 20.
  • beta::Float64: Transmission rate. Default value is 0.001.
  • gamma::Float64: Rate of exposed individuals becoming infectious. Default value is 1/4.
  • nu::Float64: Rate of infected individuals recovering or getting hospitalized. Default value is 1/7.
  • epsilon::Float64: Rate of hospitalized individuals recovering. Default value is 1/5.
  • w_init::Float64: Probability of an infected individual becoming hospitalized. Default value is 0.35.

Returns

  • df::DataFrame: A DataFrame containing the simulation data with columns Time, S, E, I, H, and R.
source
UCIWWEIHR.generate_simulation_data_uciwweihrMethod
generate_simulation_data(params::UCIWWEIHRParams)

Generates simulation data for the UCIWWEIHR ODE compartmental model.

Arguments

  • params::uciwweihr_sim_params: Struct containing parameters for the simulation.

Returns

  • df::DataFrame: A DataFrame containing the simulation data with columns obstimes, log_ww_conc, hosp, rt, and wt.
source
UCIWWEIHR.mcmcdiags_visMethod
mcmcdiags_vis(...)

Default visualizer for results of the UCIWWEIHR model, includes posterior/priors of generated quantities and posterior predictive samples for forecasting. Forecasting plots will have the observed data alongside.

Arguments

  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • desired_params: A list of lists of parameters to visualize. Each list will be visualized in a separate plot. Default is [["Einit", "Iinit", "Hinit"], ["gamma", "nu", "epsilon"], ["rhogene", "tau", "df"], ["sigma_hosp"]].
  • actual_non_time_varying_vals::uciwweihr_sim_params: A uciwweihrsimparams object of actual non-time varying parameter values if user has access to them. Default is nothing.
  • save_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.
  • plot_name_to_save: A string to indicate the name of the plot to save. Default is "mcmcdiagnosisplots".
source
UCIWWEIHR.non_time_varying_param_visMethod
non_time_varying_param_vis(...)

Used in the uciwweihr_visualizer to create visuals for non-time varying parameters.

Arguments

  • build_params::uciwweihr_model_params: A struct of model parameters used to build gq_samples, used only if user desired priors next to posteriors.
  • data_hosp: Hospitalization data, used only if user desired priors next to posteriors.
  • data_wastewater: Wastewater data, if model does not use this do not specify this, if user desires priors next to plot (do not specify if you do not want prior plots).
  • obstimes_hosp: An array of time points for hospital data, used only if user desired priors next to posteriors.
  • obstimes_wastewater: An array of time points for wastewater data, used only if user desired priors next to posteriors.
  • param_change_times: An array of time points where the parameters change, used only if user desired priors next to posteriors.
  • seed: An integer to set the seed for reproducibility, used only if user desired priors next to posteriors.
  • forecast: A boolean to indicate if user wants to forecast, used only if user desired priors next to posteriors.
  • forecast_weeks: An integer to indicate the number of weeks to forecast, used only if user desired priors next to posteriors.
  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • desired_params: A list of lists of parameters to visualize. Each list will be visualized in a separate plot. Default is any parameter not in this list : ["alphat", "wt", "rtvals", "loggenes_mean", "H"]
  • actual_non_time_varying_vals::uciwweihr_sim_params: A uciwweihrsimparams object of actual non-time varying parameter values if user has access to them. Default is nothing.
  • save_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.
  • plot_name_to_save: A string to indicate the name of the plot to save. Default is "mcmcnontimevaryingparameterplots".
source
UCIWWEIHR.powerMethod
power(a,b)
+REFERENCE · UCIWWEIHR.jl

Reference

Contents

Index

UCIWWEIHR.uciwweihr_model_paramsType
uciwweihr_model_params

Struct for holding parameters used in the UCIWWEIHR ODE compartmental model. Use create_uciwweihr_model_params to create an instance of this struct.

Fields

  • E_init_sd::Float64=50.0: Standard deviation for the initial number of exposed individuals.
  • E_init_mean::Int64=200: Mean for the initial number of exposed individuals.
  • I_init_sd::Float64=20.0: Standard deviation for the initial number of infected individuals.
  • I_init_mean::Int64=100: Mean for the initial number of infected individuals.
  • H_init_sd::Float64=5.0: Standard deviation for the initial number of hospitalized individuals.
  • H_init_mean::Int64=20: Mean for the initial number of hospitalized individuals.
  • gamma_sd::Float64=0.02: Standard deviation for the rate of incubation.
  • log_gamma_mean::Float64=log(1/4): Mean for the rate of incubation on log scale.
  • nu_sd::Float64=0.02: Standard deviation for the rate of leaving the infected compartment.
  • log_nu_mean::Float64=log(1/7): Mean for the rate of leaving the infected compartment on the log scale.
  • epsilon_sd::Float64=0.02: Standard deviation for the rate of hospitalization recovery.
  • log_epsilon_mean::Float64=log(1/5): Mean for the rate of hospitalization recovery on the log scale.
  • rho_gene_sd::Float64=0.02: Standard deviation for the rho prior.
  • log_rho_gene_mean::Float64=log(0.011): Mean for the row prior on log scale.
  • sigma_wastewater::Float64=log(0.1): Standard deviation for the negative binomial distribution for wastewater data. Not infered.
  • sigma_hosp::Float64=500.0: Standard deviation for the negative binomial distribution for hospital data. Not infered.
  • Rt_init_sd::Float64=0.3: Standard deviation for the initial value of the time-varying reproduction number.
  • Rt_init_mean::Float64=0.2: Mean for the initial value of the time-varying reproduction number.
  • sigma_Rt_sd::Float64=0.2: Standard deviation for normal prior of log time-varying reproduction number standard deviation.
  • sigma_Rt_mean::Float64=-3.0: Mean for normal prior of log time-varying reproduction number standard deviation.
  • w_init_sd::Float64=0.1: Standard deviation for the initial value of the time-varying hospitalization rate.
  • w_init_mean::Float64=log(0.35): Mean for the initial value of the time-varying hospitalization rate.
  • sigma_w_sd::Float64=0.2: Standard deviation for normal prior of log time-varying hospitalization rate standard deviation.
  • sigma_w_mean::Float64=-3.5: Mean for normal prior of time-varying hospitalization rate standard deviation.
source
UCIWWEIHR.uciwweihr_sim_paramsType
uciwweihr_sim_params

Struct for holding parameters used in the UCIWWEIHR ODE compartmental model simulation. Use create_uciwweihr_sim_params to create an instance of this struct.

Fields

  • time_points::Int64: Number of time points for the simulation.
  • seed::Int64: Seed for random number generation.
  • E_init::Int64: Initial number of exposed individuals.
  • I_init::Int64: Initial number of infected individuals.
  • H_init::Int64: Initial number of hospitalized individuals.
  • gamma::Float64: Rate of incubation.
  • nu::Float64: Rate of leaving the infected compartment.
  • epsilon::Float64: Rate of hospitalization recovery.
  • rho_gene::Float64: Contribution of infected individual's pathogen genome into wastewater.
  • tau::Float64: Scale/variation of the log concentration of pathogen genome in wastewater.
  • df::Float64: Degrees of freedom for generalized t-distribution for log concentration of pathogen genome in wastewater.
  • sigma_hosp::Float64: Standard deviation for the negative binomial distribution for hospital data.
  • Rt::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying reproduction number.
  • sigma_Rt::Float64: Standard deviation for random walk of time-varying reproduction number.
  • w::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying hospitalization rate.
  • sigma_w::Float64: Standard deviation for random walk of time-varying hospitalization rate.
  • rt_init::Float64: Initial value of the time-varying reproduction number, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.
  • w_init::Float64: Initial value of the time-varying hospitalization rate, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.
source
UCIWWEIHR.ChainsCustomIndexMethod
ChainsCustomIndex(c::Chains, indices_to_keep::BitMatrix)

Reduce Chains object to only wanted indices.

Function created by Damon Bayer.

source
UCIWWEIHR.NegativeBinomial2Method

Create a re-parametrized negative binomial distribution in terms of mean and overdispersion.

Arguments

  • μ: Mean of the distribution.
  • ϕ: Overdispersion parameter.

Returns

A Distributions.NegativeBinomial distribution object.

source
UCIWWEIHR.calculate_quantilesMethod
calculate_quantiles(df, chain, var_prefix, quantiles)

Calculate quantiles for a given chain and variable prefix. Quantiles can be any user desired quantile.

source
UCIWWEIHR.create_uciwweihr_model_paramsMethod
create_uciwweihr_model_params(; kwargs...)

Creates a uciwweihr_sim_params struct with the option to either use a predetermined Rt and w or generate them as random walks.

Arguments

  • kwargs...: Named arguments corresponding to the fields in uciwweihr_sim_params.

Returns

  • params::uciwweihr_sim_params: A struct with simulation parameters.
source
UCIWWEIHR.create_uciwweihr_sim_paramsMethod

createuciwweihrsim_params(; kwargs...)

Creates a uciwweihr_sim_params struct with the option to either use a predetermined Rt and w or generate them as random walks.

Arguments

  • kwargs...: Named arguments corresponding to the fields in uciwweihr_sim_params.

Returns

  • params::uciwweihr_sim_params: A struct with simulation parameters.
source
UCIWWEIHR.eihr_ode!Method

eihr_ode!(du, u, p, t)

Calculate the ordinary differential equations (ODEs) for the EIHR model.

Parameters:

  • du: Array{Float64,1} - The derivative of the state variables.
  • u: Array{Float64,1} - The current state variables.
  • p: Tuple{Float64,Float64,Float64,Float64,Float64} - The model parameters (alpha, gamma, nu, w, epsilon).
  • t: Float64 - The current time.

Returns:

  • du: Array{Float64,1} - The derivative of the state variables.
source
UCIWWEIHR.generate_logit_normal_random_walkMethod
generate_logit_normal_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)

Generates a logit-normal random walk time series.

Arguments

  • time_points::Int64: Number of time points.
  • sigma::Float64: Standard deviation of the random walk in logit space.
  • init_val::Float64: Initial value of the random walk on the probability scale.

Returns

  • walk::Vector{Float64}: Generated random walk on the probability scale.
source
UCIWWEIHR.generate_random_walkMethod
generate_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)

Generates a random walk time series.

Arguments

  • time_points::Int64: Number of time points.
  • sigma::Float64: Standard deviation of the random walk.
  • init_val::Float64: Initial value of the random walk.

Returns

  • walk::Vector{Float64}: Generated random walk.
source
UCIWWEIHR.generate_simulation_data_agentFunction

Generating Simulation Data for Agent Based Model

To generate simulation data using the agent based model, you can use the generate_simulation_data_agent function defined in the UCIWWEIHR.jl package. This function allows you to customize various parameters for the simulation. NOT FINISHED, STILL NEEDS WW AND RT

Function Signature

Arguments

  • seed::Int64: Seed for random number generation. Default value is 1.
  • pop_size::Int64: Size of the population. Default value is 1000.
  • I_init::Int64: Initial number of infected individuals. Default value is 200.
  • H_init::Int64: Initial number of hospitalized individuals. Default value is 20.
  • beta::Float64: Transmission rate. Default value is 0.001.
  • gamma::Float64: Rate of exposed individuals becoming infectious. Default value is 1/4.
  • nu::Float64: Rate of infected individuals recovering or getting hospitalized. Default value is 1/7.
  • epsilon::Float64: Rate of hospitalized individuals recovering. Default value is 1/5.
  • w_init::Float64: Probability of an infected individual becoming hospitalized. Default value is 0.35.

Returns

  • df::DataFrame: A DataFrame containing the simulation data with columns Time, S, E, I, H, and R.
source
UCIWWEIHR.generate_simulation_data_uciwweihrMethod
generate_simulation_data(params::UCIWWEIHRParams)

Generates simulation data for the UCIWWEIHR ODE compartmental model.

Arguments

  • params::uciwweihr_sim_params: Struct containing parameters for the simulation.

Returns

  • df::DataFrame: A DataFrame containing the simulation data with columns obstimes, log_ww_conc, hosp, rt, and wt.
source
UCIWWEIHR.mcmcdiags_visMethod
mcmcdiags_vis(...)

Default visualizer for results of the UCIWWEIHR model, includes posterior/priors of generated quantities and posterior predictive samples for forecasting. Forecasting plots will have the observed data alongside.

Arguments

  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • desired_params: A list of lists of parameters to visualize. Each list will be visualized in a separate plot. Default is [["Einit", "Iinit", "Hinit"], ["gamma", "nu", "epsilon"], ["rhogene", "tau", "df"], ["sigma_hosp"]].
  • actual_non_time_varying_vals::uciwweihr_sim_params: A uciwweihrsimparams object of actual non-time varying parameter values if user has access to them. Default is nothing.
  • save_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.
  • plot_name_to_save: A string to indicate the name of the plot to save. Default is "mcmcdiagnosisplots".
source
UCIWWEIHR.non_time_varying_param_visMethod
non_time_varying_param_vis(...)

Used in the uciwweihr_visualizer to create visuals for non-time varying parameters.

Arguments

  • build_params::uciwweihr_model_params: A struct of model parameters used to build gq_samples, used only if user desired priors next to posteriors.
  • data_hosp: Hospitalization data, used only if user desired priors next to posteriors.
  • data_wastewater: Wastewater data, if model does not use this do not specify this, if user desires priors next to plot (do not specify if you do not want prior plots).
  • obstimes_hosp: An array of time points for hospital data, used only if user desired priors next to posteriors.
  • obstimes_wastewater: An array of time points for wastewater data, used only if user desired priors next to posteriors.
  • param_change_times: An array of time points where the parameters change, used only if user desired priors next to posteriors.
  • seed: An integer to set the seed for reproducibility, used only if user desired priors next to posteriors.
  • forecast: A boolean to indicate if user wants to forecast, used only if user desired priors next to posteriors.
  • forecast_weeks: An integer to indicate the number of weeks to forecast, used only if user desired priors next to posteriors.
  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • desired_params: A list of lists of parameters to visualize. Each list will be visualized in a separate plot. Default is any parameter not in this list : ["alphat", "wt", "rtvals", "loggenes_mean", "H"]
  • actual_non_time_varying_vals::uciwweihr_sim_params: A uciwweihrsimparams object of actual non-time varying parameter values if user has access to them. Default is nothing.
  • save_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.
  • plot_name_to_save: A string to indicate the name of the plot to save. Default is "mcmcnontimevaryingparameterplots".
source
UCIWWEIHR.predictive_param_visMethod
predictive_param_vis(...)

Used in the uciwweihr_visualizer to create visuals for wastewater data and hospitalization data.

Arguments

  • pp_samples: A DataFrame of posterior or prior predictive samples.
  • data_wastewater: An array of actual wastewater values if user has access to them assumed, using time scale of observed time points. Default is nothing.
  • data_hosp: An array of actual hospitalization values if user has access to them assumed, , using time scale of observed time points. Default is nothing.
  • forecast_weeks: An integer of the number of weeks forecasted. Default is 0.
  • vars_to_pred: A list of variables to predict. Default is ["datawastewater", "datahosp"].
  • quantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].
  • bayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is "Posterior".
  • save_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.
  • plot_name_to_save: A string to indicate the name of the plot to save. Default is "mcmcpredparameter_plots".
source
UCIWWEIHR.repeated_forecastMethod
repeated_forecast(...)

This is the function to make repreated forecast for a given forecast time span, n_forecast_weeks, and for given time points, forecast_points. Plots can be made for these forecasts. The output is an array of uciwweihr_gq_pp results for each forecast_points.

Arguments

  • data_hosp: The hospitalization data.
  • data_wastewater: The wastewater data.
  • obstimes_hosp: The time points for the hospitalization data.
  • obstimes_wastewater: The time points for the wastewater data.
  • n_samples: The number of samples to draw from the posterior.
  • param_change_times: The time points where the parameters change.
  • params::uciwweihr_model_params: The model parameters.
  • n_forecast_weeks: The number of weeks to forecast.
  • forecast_points: The time points to forecast, thees points should be present in obstimes_hosp.

Returns

  • An array of uciwweihr_gq_pp resuts and timeseries used for building for each forecast_points.
source
UCIWWEIHR.uciwweihr_fitMethod
uciwweihr_fit(...)

This is the sampler for the bayesian semi-parametric model for the wastewater EIHR compartmental model. The defaults for this fuction will follow those of the default simulation in generatesimulationdatawweihr.jl function.

Arguments

  • data_hosp: An array of hospital data.
  • data_wastewater: An array of pathogen genome concentration in localized wastewater data. If this is not avaliable, the model used will be one that only uses hospital data.
  • obstimes: An array of timepoints for observed hosp/wastewater.
  • priors_only::Bool=false: A boolean to indicate if only priors are to be sampled.
  • n_samples::Int64=500: Number of samples to be drawn.
  • n_chains::Int64=1: Number of chains to be run.
  • seed::Int64=2024: Seed for the random number generator.
  • params::uciwweihr_model_params: A struct containing parameters for the model.

Returns

  • Samples from the posterior or prior distribution.
source
UCIWWEIHR.uciwweihr_modelMethod
uciwweihr_model(...)

This is the bayesian semi-parametric model for the wastewater EIHR compartmental model. The defaults for this fuction will follow those of the default simulation in generatesimulationdatawweihr.jl function.

Arguments

  • data_hosp: An array of hospital data.
  • data_wastewater: An array of pathogen genome concentration in localized wastewater data. If this is not avaliable, the model used will be one that only uses hospital data.
  • obstimes_hosp: An array of timepoints for observed hospital data.
  • obstimes_wastewater: An array of timepoints for observed wastewater data.
  • param_change_times: An array of timepoints where the parameters change.
  • params::uciwweihr_model_params: A struct containing parameters for the model.
source
+Raise `a` to the `b` power
source
UCIWWEIHR.predictive_param_visMethod
predictive_param_vis(...)

Used in the uciwweihr_visualizer to create visuals for wastewater data and hospitalization data.

Arguments

  • pp_samples: A DataFrame of posterior or prior predictive samples.
  • data_wastewater: An array of actual wastewater values if user has access to them assumed, using time scale of observed time points. Default is nothing.
  • data_hosp: An array of actual hospitalization values if user has access to them assumed, , using time scale of observed time points. Default is nothing.
  • forecast_weeks: An integer of the number of weeks forecasted. Default is 0.
  • vars_to_pred: A list of variables to predict. Default is ["datawastewater", "datahosp"].
  • quantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].
  • bayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is "Posterior".
  • save_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.
  • plot_name_to_save: A string to indicate the name of the plot to save. Default is "mcmcpredparameter_plots".
source
UCIWWEIHR.repeated_forecastMethod
repeated_forecast(...)

This is the function to make repreated forecast for a given forecast time span, n_forecast_weeks, and for given time points, forecast_points. Plots can be made for these forecasts. The output is an array of uciwweihr_gq_pp results for each forecast_points.

Arguments

  • data_hosp: The hospitalization data.
  • data_wastewater: The wastewater data.
  • obstimes_hosp: The time points for the hospitalization data.
  • obstimes_wastewater: The time points for the wastewater data.
  • n_samples: The number of samples to draw from the posterior.
  • param_change_times: The time points where the parameters change.
  • params::uciwweihr_model_params: The model parameters.
  • n_forecast_weeks: The number of weeks to forecast.
  • forecast_points: The time points to forecast, thees points should be present in obstimes_hosp.

Returns

  • An array of uciwweihr_gq_pp resuts and timeseries used for building for each forecast_points.
source
UCIWWEIHR.uciwweihr_fitMethod
uciwweihr_fit(...)

This is the sampler for the bayesian semi-parametric model for the wastewater EIHR compartmental model. The defaults for this fuction will follow those of the default simulation in generatesimulationdatawweihr.jl function.

Arguments

  • data_hosp: An array of hospital data.
  • data_wastewater: An array of pathogen genome concentration in localized wastewater data. If this is not avaliable, the model used will be one that only uses hospital data.
  • obstimes: An array of timepoints for observed hosp/wastewater.
  • priors_only::Bool=false: A boolean to indicate if only priors are to be sampled.
  • n_samples::Int64=500: Number of samples to be drawn.
  • n_chains::Int64=1: Number of chains to be run.
  • seed::Int64=2024: Seed for the random number generator.
  • params::uciwweihr_model_params: A struct containing parameters for the model.

Returns

  • Samples from the posterior or prior distribution.
source
UCIWWEIHR.uciwweihr_modelMethod
uciwweihr_model(...)

This is the bayesian semi-parametric model for the wastewater EIHR compartmental model. The defaults for this fuction will follow those of the default simulation in generatesimulationdatawweihr.jl function.

Arguments

  • data_hosp: An array of hospital data.
  • data_wastewater: An array of pathogen genome concentration in localized wastewater data. If this is not avaliable, the model used will be one that only uses hospital data.
  • obstimes_hosp: An array of timepoints for observed hospital data.
  • obstimes_wastewater: An array of timepoints for observed wastewater data.
  • param_change_times: An array of timepoints where the parameters change.
  • params::uciwweihr_model_params: A struct containing parameters for the model.
source
diff --git a/dev/tutorial_index/index.html b/dev/tutorial_index/index.html index d95d806..08b3402 100644 --- a/dev/tutorial_index/index.html +++ b/dev/tutorial_index/index.html @@ -1,2 +1,2 @@ -TUTORIAL CONTENTS · UCIWWEIHR.jl
+TUTORIAL CONTENTS · UCIWWEIHR.jl
diff --git a/dev/tutorials/agent_based_simulation_data/e827edc2.svg b/dev/tutorials/agent_based_simulation_data/557436bd.svg similarity index 87% rename from dev/tutorials/agent_based_simulation_data/e827edc2.svg rename to dev/tutorials/agent_based_simulation_data/557436bd.svg index eeb65b1..dbf7778 100644 --- a/dev/tutorials/agent_based_simulation_data/e827edc2.svg +++ b/dev/tutorials/agent_based_simulation_data/557436bd.svg @@ -1,58 +1,58 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/agent_based_simulation_data/index.html b/dev/tutorials/agent_based_simulation_data/index.html index fe40c5a..4274d66 100644 --- a/dev/tutorials/agent_based_simulation_data/index.html +++ b/dev/tutorials/agent_based_simulation_data/index.html @@ -10,4 +10,4 @@ plot!(df.Time, df.E, label = "Exposed") plot!(df.Time, df.I, label = "Infected") plot!(df.Time, df.H, label = "Hospitalized") -plot!(df.Time, df.R, label = "Recovered")Example block output

Tutorial Contents

+plot!(df.Time, df.R, label = "Recovered")Example block output

Tutorial Contents

diff --git a/dev/tutorials/getting_started/index.html b/dev/tutorials/getting_started/index.html index 1fbcb0e..b5d245f 100644 --- a/dev/tutorials/getting_started/index.html +++ b/dev/tutorials/getting_started/index.html @@ -1,3 +1,3 @@ GETTING STARTED · UCIWWEIHR.jl

Getting Started

Welcome to the Tutorials page for the UCIWWEIHR.jl project. This section provides step-by-step guides and examples to help you get started with using the package and understanding its features.

1. Installation.

To install the UCIWWEIHR.jl package, open the Julia REPL and run the following command:

using Pkg
-Pkg.add("https://github.com/cbernalz/UCIWWEIHR.jl.git")

Tutorial Contents

+Pkg.add("https://github.com/cbernalz/UCIWWEIHR.jl.git")

Tutorial Contents

diff --git a/dev/tutorials/plots/mcmc_diagnosis_plots.png b/dev/tutorials/plots/mcmc_diagnosis_plots.png index f6630ac..e5fce97 100644 Binary files a/dev/tutorials/plots/mcmc_diagnosis_plots.png and b/dev/tutorials/plots/mcmc_diagnosis_plots.png differ diff --git a/dev/tutorials/plots/mcmc_diagnosis_plots1.png b/dev/tutorials/plots/mcmc_diagnosis_plots1.png index 367a252..c9c51b6 100644 Binary files a/dev/tutorials/plots/mcmc_diagnosis_plots1.png and b/dev/tutorials/plots/mcmc_diagnosis_plots1.png differ diff --git a/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots.png b/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots.png index 70f8fd5..2e7c519 100644 Binary files a/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots.png and b/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots.png differ diff --git a/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots1.png b/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots1.png index 7b37dfa..6f79881 100644 Binary files a/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots1.png and b/dev/tutorials/plots/mcmc_nontime_varying_parameter_plots1.png differ diff --git a/dev/tutorials/plots/mcmc_pred_parameter_plots.png b/dev/tutorials/plots/mcmc_pred_parameter_plots.png index af8b726..98141ae 100644 Binary files a/dev/tutorials/plots/mcmc_pred_parameter_plots.png and b/dev/tutorials/plots/mcmc_pred_parameter_plots.png differ diff --git a/dev/tutorials/plots/mcmc_pred_parameter_plots1.png b/dev/tutorials/plots/mcmc_pred_parameter_plots1.png index fdf292f..1a7020f 100644 Binary files a/dev/tutorials/plots/mcmc_pred_parameter_plots1.png and b/dev/tutorials/plots/mcmc_pred_parameter_plots1.png differ diff --git a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res1.png b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res1.png index 5617cf1..6a210ef 100644 Binary files a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res1.png and b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res1.png differ diff --git a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res2.png b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res2.png index 0bec02a..ddcc6da 100644 Binary files a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res2.png and b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res2.png differ diff --git a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res3.png b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res3.png index 5f60bac..7c12642 100644 Binary files a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res3.png and b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res3.png differ diff --git a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res4.png b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res4.png index b8c55d6..5e82589 100644 Binary files a/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res4.png and b/dev/tutorials/plots/mcmc_pred_parameter_plots_rep_res4.png differ diff --git a/dev/tutorials/plots/mcmc_time_varying_parameter_plots.png b/dev/tutorials/plots/mcmc_time_varying_parameter_plots.png index 6335b2f..edec25c 100644 Binary files a/dev/tutorials/plots/mcmc_time_varying_parameter_plots.png and b/dev/tutorials/plots/mcmc_time_varying_parameter_plots.png differ diff --git a/dev/tutorials/plots/mcmc_time_varying_parameter_plots1.png b/dev/tutorials/plots/mcmc_time_varying_parameter_plots1.png index 8c6d499..83d21b5 100644 Binary files a/dev/tutorials/plots/mcmc_time_varying_parameter_plots1.png and b/dev/tutorials/plots/mcmc_time_varying_parameter_plots1.png differ diff --git a/dev/tutorials/uciwweihr_model_repeated_forecasts/index.html b/dev/tutorials/uciwweihr_model_repeated_forecasts/index.html index 9cbb505..3fda423 100644 --- a/dev/tutorials/uciwweihr_model_repeated_forecasts/index.html +++ b/dev/tutorials/uciwweihr_model_repeated_forecasts/index.html @@ -23,7 +23,7 @@ w = w_custom ) df = generate_simulation_data_uciwweihr(params) -first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.271684161.00.3
220.517405271.029630.302353
330.498941241.059260.304706
440.764782231.088890.307059
550.814226321.118520.309412

2. Constructing Repeat Forecasts.

We use the repeated_forecast function to generate forecasts for a given number of weeks, for a given number of time points. Along with this we need to specify presets. Output of this function is an array with the first index controlling which result we are looking at. The next contains a uciwweihr_gq_pp output.

data_hosp = df.hosp
+first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.347026181.00.3
220.550405261.029630.302353
330.503247291.059260.304706
440.885447361.088890.307059
550.794372281.118520.309412

2. Constructing Repeat Forecasts.

We use the repeated_forecast function to generate forecasts for a given number of weeks, for a given number of time points. Along with this we need to specify presets. Output of this function is an array with the first index controlling which result we are looking at. The next contains a uciwweihr_gq_pp output.

data_hosp = df.hosp
 data_wastewater = df.log_ww_conc
 obstimes_hosp = df.obstimes
 obstimes_wastewater = df.obstimes
@@ -53,7 +53,7 @@
 )
 
 first(rep_results, 2)
2-element Vector{Any}:
- Vector[AbstractVector[[16, 27, 24, 23, 32, 23, 36, 26, 48, 39  …  1141, 1085, 1151, 1173, 1121, 1137, 1111, 1085, 1098, 1070], [0.2716835956059569, 0.5174052288422613, 0.49894101469467933, 0.7647815324347761, 0.8142258870064067, 0.7077613914126195, 0.8128588736898072, 0.8367322730889285, 0.8560749310751792, 0.6766463204741437  …  3.9741877510982913, 4.106931068224391, 3.924448571274242, 4.06927225080228, 4.036560912641182, 4.136947952411274, 3.94586332379365, 4.058564761711565, 4.0017797643566135, 4.202732736555433], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  125, 126, 127, 128, 129, 130, 131, 132, 133, 134], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  125, 126, 127, 128, 129, 130, 131, 132, 133, 134], 1:1:20], DataFrames.DataFrame[200×278 DataFrame
+ Vector[AbstractVector[[18, 26, 29, 36, 28, 24, 22, 43, 48, 43  …  1098, 1194, 1212, 1106, 1134, 1102, 1085, 1078, 997, 1176], [0.3470256452290231, 0.5504052568775065, 0.5032465035820112, 0.8854468018101448, 0.7943722906258144, 0.7326062459711118, 0.9031816859718784, 0.6651544997374057, 0.6621119546322024, 0.7523547654550962  …  3.879952457492709, 4.21776048218676, 4.06605557786951, 3.97446956404358, 4.006369948865927, 3.7837478692219753, 3.8675931784165853, 3.973924170096727, 3.942822816581617, 4.1383166461738545], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  125, 126, 127, 128, 129, 130, 131, 132, 133, 134], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  125, 126, 127, 128, 129, 130, 131, 132, 133, 134], 1:1:20], DataFrames.DataFrame[200×278 DataFrame
  Row │ iteration  chain  Rt_params_non_centered[23]  Rt_params_non_centered[24 ⋯
      │ Int64      Int64  Float64                     Float64                   ⋯
 ─────┼──────────────────────────────────────────────────────────────────────────
@@ -74,47 +74,47 @@
  199 │       199      1                   -0.041831                     1.3231
  200 │       200      1                   -0.041831                     1.3231
                                                 275 columns and 185 rows omitted, 200×352 DataFrame
- Row │ iteration  chain  E_init   I_init    H_init    alpha_t[1]  alpha_t[2]   ⋯
-     │ Int64      Int64  Float64  Float64   Float64   Float64     Float64      ⋯
+ Row │ iteration  chain  E_init   I_init    H_init   alpha_t[1]  alpha_t[2]  a ⋯
+     │ Int64      Int64  Float64  Float64   Float64  Float64     Float64     F ⋯
 ─────┼──────────────────────────────────────────────────────────────────────────
-   1 │         1      1  198.198  100.884   15.4308     0.112985    0.113609   ⋯
-   2 │         2      1  185.535   96.1797  14.7671     0.121153    0.125493
-   3 │         3      1  174.903  104.27    14.8886     0.129673    0.136627
-   4 │         4      1  198.485  105.919   14.8098     0.118854    0.138218
-   5 │         5      1  175.878  110.836   15.9382     0.103275    0.127201   ⋯
-   6 │         6      1  202.349  114.424   15.9023     0.112224    0.174604
-   7 │         7      1  183.334  110.45    15.4085     0.113232    0.169828
-   8 │         8      1  222.856   91.3463  15.9191     0.125702    0.159786
-  ⋮  │     ⋮        ⋮       ⋮        ⋮         ⋮          ⋮           ⋮        ⋱
- 194 │       194      1  257.116   87.4943   9.86869    0.166077    0.131731   ⋯
- 195 │       195      1  257.145   87.4793   9.86573    0.166079    0.131715
- 196 │       196      1  257.135   87.4648   9.86589    0.166016    0.131639
- 197 │       197      1  257.135   87.4648   9.86589    0.166016    0.131639
- 198 │       198      1  256.939   87.6067   9.96119    0.167618    0.134579   ⋯
- 199 │       199      1  246.499   86.4112  10.1079     0.16994     0.132896
- 200 │       200      1  237.754   81.5766  13.3831     0.202127    0.161385
+   1 │         1      1  176.484   92.7584  23.9302   0.257095    0.142249     ⋯
+   2 │         2      1  172.077   87.9503  23.5601   0.266785    0.136065
+   3 │         3      1  165.124   87.8473  23.1295   0.282457    0.143923
+   4 │         4      1  173.121   86.0772  22.4101   0.292577    0.133194
+   5 │         5      1  160.432   89.3926  20.7632   0.315099    0.128382     ⋯
+   6 │         6      1  176.695  100.121   22.3392   0.31376     0.136014
+   7 │         7      1  170.72    93.8778  20.3684   0.335102    0.161949
+   8 │         8      1  159.328   93.8581  19.5219   0.335958    0.175534
+  ⋮  │     ⋮        ⋮       ⋮        ⋮         ⋮         ⋮           ⋮         ⋱
+ 194 │       194      1  195.595  114.438   18.3664   0.0798289   0.120904     ⋯
+ 195 │       195      1  198.452  112.514   18.9542   0.0810582   0.128762
+ 196 │       196      1  204.723  114.484   18.4231   0.0831119   0.119631
+ 197 │       197      1  203.335  113.434   17.8474   0.0740414   0.116059
+ 198 │       198      1  211.788  116.951   18.0052   0.0883914   0.145198     ⋯
+ 199 │       199      1  212.737  117.034   17.6459   0.087666    0.144338
+ 200 │       200      1  208.215  110.209   17.4911   0.0763789   0.116958
                                                 345 columns and 185 rows omitted, 200×65 DataFrame
  Row │ iteration  chain  E_init_non_centered  I_init_non_centered  H_init_non_ ⋯
      │ Int64      Int64  Float64              Float64              Float64     ⋯
 ─────┼──────────────────────────────────────────────────────────────────────────
-   1 │       101      1           -0.036049             0.0442148            - ⋯
-   2 │       102      1           -0.289293            -0.191017             -
-   3 │       103      1           -0.501942             0.213515             -
-   4 │       104      1           -0.0302918            0.295949             -
-   5 │       105      1           -0.48244              0.541785             - ⋯
-   6 │       106      1            0.046977             0.721178             -
-   7 │       107      1           -0.333324             0.52252              -
-   8 │       108      1            0.457113            -0.432687             -
+   1 │       101      1           -0.470315           -0.362079              0 ⋯
+   2 │       102      1           -0.558455           -0.602483              0
+   3 │       103      1           -0.69752            -0.607633              0
+   4 │       104      1           -0.537584           -0.696141              0
+   5 │       105      1           -0.791366           -0.530371              0 ⋯
+   6 │       106      1           -0.466109            0.00603394            0
+   7 │       107      1           -0.585599           -0.306112              0
+   8 │       108      1           -0.813447           -0.307096             -0
   ⋮  │     ⋮        ⋮             ⋮                    ⋮                    ⋮  ⋱
- 194 │       294      1            1.14231             -0.625283             - ⋯
- 195 │       295      1            1.14291             -0.626037             -
- 196 │       296      1            1.14269             -0.626758             -
- 197 │       297      1            1.14269             -0.626758             -
- 198 │       298      1            1.13878             -0.619663             - ⋯
- 199 │       299      1            0.929978            -0.679439             -
- 200 │       300      1            0.755071            -0.921171             -
+ 194 │       294      1           -0.0881073           0.721898             -0 ⋯
+ 195 │       295      1           -0.0309611           0.62572              -0
+ 196 │       296      1            0.0944565           0.724191             -0
+ 197 │       297      1            0.0666928           0.671709             -0
+ 198 │       298      1            0.235751            0.847547             -0 ⋯
+ 199 │       299      1            0.254735            0.851676             -0
+ 200 │       300      1            0.164304            0.510425             -0
                                                  61 columns and 185 rows omitted]]
- Vector[AbstractVector[[16, 27, 24, 23, 32, 23, 36, 26, 48, 39  …  1085, 1098, 1070, 1078, 1178, 953, 930, 1055, 1030, 980], [0.2716835956059569, 0.5174052288422613, 0.49894101469467933, 0.7647815324347761, 0.8142258870064067, 0.7077613914126195, 0.8128588736898072, 0.8367322730889285, 0.8560749310751792, 0.6766463204741437  …  4.058564761711565, 4.0017797643566135, 4.202732736555433, 3.9880441481014692, 4.0483358506660645, 4.039234892485207, 4.007779414594093, 3.9386981113856323, 3.9705884999161127, 3.7858012802598733], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  132, 133, 134, 135, 136, 137, 138, 139, 140, 141], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  132, 133, 134, 135, 136, 137, 138, 139, 140, 141], 1:1:21], DataFrames.DataFrame[200×292 DataFrame
+ Vector[AbstractVector[[18, 26, 29, 36, 28, 24, 22, 43, 48, 43  …  1078, 997, 1176, 1085, 1098, 1104, 1130, 1119, 1077, 999], [0.3470256452290231, 0.5504052568775065, 0.5032465035820112, 0.8854468018101448, 0.7943722906258144, 0.7326062459711118, 0.9031816859718784, 0.6651544997374057, 0.6621119546322024, 0.7523547654550962  …  3.973924170096727, 3.942822816581617, 4.1383166461738545, 3.901606445055345, 3.9531924835965233, 3.981038107330166, 4.135060546324441, 4.074674542892423, 3.9256992569673375, 4.16988625143474], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  132, 133, 134, 135, 136, 137, 138, 139, 140, 141], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10  …  132, 133, 134, 135, 136, 137, 138, 139, 140, 141], 1:1:21], DataFrames.DataFrame[200×292 DataFrame
  Row │ iteration  chain  Rt_params_non_centered[24]  Rt_params_non_centered[25 ⋯
      │ Int64      Int64  Float64                     Float64                   ⋯
 ─────┼──────────────────────────────────────────────────────────────────────────
@@ -138,42 +138,42 @@
  Row │ iteration  chain  E_init   I_init    H_init   alpha_t[1]  alpha_t[2]  a ⋯
      │ Int64      Int64  Float64  Float64   Float64  Float64     Float64     F ⋯
 ─────┼──────────────────────────────────────────────────────────────────────────
-   1 │         1      1  185.466   93.4179  13.4696    0.288082    0.265974    ⋯
-   2 │         2      1  160.551   93.952   17.2148    0.283735    0.289586
-   3 │         3      1  137.107   98.3958  18.053     0.278471    0.333659
-   4 │         4      1  128.918  103.15    18.6518    0.254044    0.302873
-   5 │         5      1  144.884  104.883   18.4893    0.231445    0.255191    ⋯
-   6 │         6      1  157.982  101.486   17.4236    0.21621     0.257733
-   7 │         7      1  155.212   99.3892  17.7361    0.227866    0.263952
-   8 │         8      1  158.584   95.7432  17.5043    0.243849    0.31437
+   1 │         1      1  204.048   96.1275  18.7159    0.165151   0.133758     ⋯
+   2 │         2      1  194.242   97.4375  19.0279    0.159941   0.125737
+   3 │         3      1  196.439   99.952   19.5036    0.168205   0.124545
+   4 │         4      1  205.625  101.273   19.9008    0.169767   0.111309
+   5 │         5      1  224.551  104.444   17.1725    0.148054   0.0771633    ⋯
+   6 │         6      1  230.044  103.693   18.2312    0.142174   0.0762896
+   7 │         7      1  215.704  102.787   17.3779    0.145282   0.076451
+   8 │         8      1  258.631   96.2278  17.8812    0.160592   0.0589822
   ⋮  │     ⋮        ⋮       ⋮        ⋮         ⋮         ⋮           ⋮         ⋱
- 194 │       194      1  223.474   82.9762  17.9835    0.259084    0.127035    ⋯
- 195 │       195      1  222.342   82.0706  17.8516    0.266064    0.12571
- 196 │       196      1  222.16    82.2132  17.9225    0.266327    0.124988
- 197 │       197      1  222.434   82.5502  17.9248    0.267778    0.125736
- 198 │       198      1  222.779   81.5989  17.827     0.264731    0.124751    ⋯
- 199 │       199      1  223.659   81.9988  17.6033    0.267315    0.128908
- 200 │       200      1  247.08    77.5757  17.7427    0.250586    0.106419
+ 194 │       194      1  223.556  111.112   15.6728    0.127365   0.0717124    ⋯
+ 195 │       195      1  219.318  110.078   14.5344    0.131707   0.0766264
+ 196 │       196      1  210.761  102.906   14.3799    0.138354   0.0770936
+ 197 │       197      1  206.651  106.405   14.3228    0.135516   0.0738773
+ 198 │       198      1  212.659  109.317   15.5252    0.154666   0.0820118    ⋯
+ 199 │       199      1  211.119  112.53    15.4136    0.141933   0.0736239
+ 200 │       200      1  203.871  115.587   15.3952    0.136583   0.0590842
                                                 362 columns and 185 rows omitted, 200×67 DataFrame
  Row │ iteration  chain  E_init_non_centered  I_init_non_centered  H_init_non_ ⋯
      │ Int64      Int64  Float64              Float64              Float64     ⋯
 ─────┼──────────────────────────────────────────────────────────────────────────
-   1 │       101      1           -0.290674            -0.329107             - ⋯
-   2 │       102      1           -0.788971            -0.302402             -
-   3 │       103      1           -1.25786             -0.0802085            -
-   4 │       104      1           -1.42165              0.15751              -
-   5 │       105      1           -1.10231              0.24413              - ⋯
-   6 │       106      1           -0.84035              0.0743238            -
-   7 │       107      1           -0.89576             -0.0305412            -
-   8 │       108      1           -0.828324            -0.212838             -
+   1 │       101      1            0.0809603          -0.193626             -0 ⋯
+   2 │       102      1           -0.115153           -0.128125             -0
+   3 │       103      1           -0.0712259          -0.00239925           -0
+   4 │       104      1            0.112503            0.0636446            -0
+   5 │       105      1            0.491011            0.222203             -0 ⋯
+   6 │       106      1            0.600875            0.184639             -0
+   7 │       107      1            0.314071            0.139345             -0
+   8 │       108      1            1.17262            -0.188611             -0
   ⋮  │     ⋮        ⋮             ⋮                    ⋮                    ⋮  ⋱
- 194 │       294      1            0.469486            -0.851191             - ⋯
- 195 │       295      1            0.446846            -0.896471             -
- 196 │       296      1            0.443193            -0.889338             -
- 197 │       297      1            0.448686            -0.872492             -
- 198 │       298      1            0.455574            -0.920054             - ⋯
- 199 │       299      1            0.473188            -0.900061             -
- 200 │       300      1            0.941592            -1.12122              -
+ 194 │       294      1            0.471125            0.555582             -0 ⋯
+ 195 │       295      1            0.386357            0.503895             -1
+ 196 │       296      1            0.215225            0.145313             -1
+ 197 │       297      1            0.133025            0.320269             -1
+ 198 │       298      1            0.253181            0.465867             -0 ⋯
+ 199 │       299      1            0.222379            0.626495             -0
+ 200 │       300      1            0.0774105           0.779346             -0
                                                  63 columns and 185 rows omitted]]

3. Visualizing Results Of Repeated Forecasts.

We can take a look at these forecasts using the uciwweihr_visualizer function. We can also add certain parameters to ensure we only see the plots we want.

for res_index in 1:length(forecast_points)
     uciwweihr_visualizer(
         data_hosp,
@@ -215,4 +215,4 @@
 MCMC Diagnostics Plots are not requested.
 MCMC time varying parameter results are not requested.
 MCMC non-time varying parameter results are not requested.
-Plot saved to plots/mcmc_pred_parameter_plots_rep_res4.png

3.1. Forecast Point 1.

Plot 1

3.2. Forecast Point 2.

Plot 2

3.3. Forecast Point 3.

Plot 3

3.4. Forecast Point 4.

Plot 4

Tutorial Contents

+Plot saved to plots/mcmc_pred_parameter_plots_rep_res4.png

3.1. Forecast Point 1.

Plot 1

3.2. Forecast Point 2.

Plot 2

3.3. Forecast Point 3.

Plot 3

3.4. Forecast Point 4.

Plot 4

Tutorial Contents

diff --git a/dev/tutorials/uciwweihr_simulation_data/6396cdc5.svg b/dev/tutorials/uciwweihr_simulation_data/2cc0ee4d.svg similarity index 86% rename from dev/tutorials/uciwweihr_simulation_data/6396cdc5.svg rename to dev/tutorials/uciwweihr_simulation_data/2cc0ee4d.svg index 1937388..91438b2 100644 --- a/dev/tutorials/uciwweihr_simulation_data/6396cdc5.svg +++ b/dev/tutorials/uciwweihr_simulation_data/2cc0ee4d.svg @@ -1,39 +1,39 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/3023dc0b.svg b/dev/tutorials/uciwweihr_simulation_data/3023dc0b.svg new file mode 100644 index 0000000..0f4ac75 --- /dev/null +++ b/dev/tutorials/uciwweihr_simulation_data/3023dc0b.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/43807cd6.svg b/dev/tutorials/uciwweihr_simulation_data/43807cd6.svg new file mode 100644 index 0000000..4429da5 --- /dev/null +++ b/dev/tutorials/uciwweihr_simulation_data/43807cd6.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/2be2e446.svg b/dev/tutorials/uciwweihr_simulation_data/617b6b8b.svg similarity index 87% rename from dev/tutorials/uciwweihr_simulation_data/2be2e446.svg rename to dev/tutorials/uciwweihr_simulation_data/617b6b8b.svg index bf4c835..f3ccffe 100644 --- a/dev/tutorials/uciwweihr_simulation_data/2be2e446.svg +++ b/dev/tutorials/uciwweihr_simulation_data/617b6b8b.svg @@ -1,41 +1,41 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/71f90d5f.svg b/dev/tutorials/uciwweihr_simulation_data/71f90d5f.svg deleted file mode 100644 index ec7b8c7..0000000 --- a/dev/tutorials/uciwweihr_simulation_data/71f90d5f.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/tutorials/uciwweihr_simulation_data/286f1eb4.svg b/dev/tutorials/uciwweihr_simulation_data/729ef860.svg similarity index 87% rename from dev/tutorials/uciwweihr_simulation_data/286f1eb4.svg rename to dev/tutorials/uciwweihr_simulation_data/729ef860.svg index bac0edb..974d634 100644 --- a/dev/tutorials/uciwweihr_simulation_data/286f1eb4.svg +++ b/dev/tutorials/uciwweihr_simulation_data/729ef860.svg @@ -1,39 +1,39 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/7e91b1fe.svg b/dev/tutorials/uciwweihr_simulation_data/7e91b1fe.svg deleted file mode 100644 index 8022bdf..0000000 --- a/dev/tutorials/uciwweihr_simulation_data/7e91b1fe.svg +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/tutorials/uciwweihr_simulation_data/1f63807b.svg b/dev/tutorials/uciwweihr_simulation_data/807f0942.svg similarity index 85% rename from dev/tutorials/uciwweihr_simulation_data/1f63807b.svg rename to dev/tutorials/uciwweihr_simulation_data/807f0942.svg index 2bb3c24..a75f990 100644 --- a/dev/tutorials/uciwweihr_simulation_data/1f63807b.svg +++ b/dev/tutorials/uciwweihr_simulation_data/807f0942.svg @@ -1,41 +1,41 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/88781e68.svg b/dev/tutorials/uciwweihr_simulation_data/88781e68.svg new file mode 100644 index 0000000..a9309b4 --- /dev/null +++ b/dev/tutorials/uciwweihr_simulation_data/88781e68.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/95e79acf.svg b/dev/tutorials/uciwweihr_simulation_data/95e79acf.svg deleted file mode 100644 index ddc2e87..0000000 --- a/dev/tutorials/uciwweihr_simulation_data/95e79acf.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/tutorials/uciwweihr_simulation_data/c8bd6c26.svg b/dev/tutorials/uciwweihr_simulation_data/c8bd6c26.svg new file mode 100644 index 0000000..933f94f --- /dev/null +++ b/dev/tutorials/uciwweihr_simulation_data/c8bd6c26.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/f7ba540c.svg b/dev/tutorials/uciwweihr_simulation_data/f7ba540c.svg deleted file mode 100644 index c27088c..0000000 --- a/dev/tutorials/uciwweihr_simulation_data/f7ba540c.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dev/tutorials/uciwweihr_simulation_data/index.html b/dev/tutorials/uciwweihr_simulation_data/index.html index 377bd7e..5d4b564 100644 --- a/dev/tutorials/uciwweihr_simulation_data/index.html +++ b/dev/tutorials/uciwweihr_simulation_data/index.html @@ -4,23 +4,23 @@ # Running simulation function with defaults params = create_uciwweihr_sim_params() df = generate_simulation_data_uciwweihr(params) -first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.271654260.997770.349492
220.517304161.014680.353323
330.498552250.9891190.347515
440.762967311.069040.365335
550.810309371.109150.373918

1.2 Visualizing UCIWWEIHR model results.

Here we can make simple plots to visualize the data generated using the Plots package.

1.2.1. Concentration of pathogen genome in wastewater(WW).

plot(df.obstimes, df.log_ww_conc,
+first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.346996180.997770.349492
220.550305241.014680.353323
330.502858400.9891190.347515
440.883632311.069040.365335
550.790455331.109150.373918

1.2 Visualizing UCIWWEIHR model results.

Here we can make simple plots to visualize the data generated using the Plots package.

1.2.1. Concentration of pathogen genome in wastewater(WW).

plot(df.obstimes, df.log_ww_conc,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Conc. of Pathogen Genome in WW",
-    title="Plot of Conc. of Pathogen Genome in WW Over Time")
Example block output

1.2.2. Hospitalizations.

plot(df.obstimes, df.hosp,
+    title="Plot of Conc. of Pathogen Genome in WW Over Time")
Example block output

1.2.2. Hospitalizations.

plot(df.obstimes, df.hosp,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Hosp",
-    title="Plot of Hosp Over Time")
Example block output

1.2.3. Reproductive number.

plot(df.obstimes, df.rt,
+    title="Plot of Hosp Over Time")
Example block output

1.2.3. Reproductive number.

plot(df.obstimes, df.rt,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Rt",
-    title="Plot of Rt Over Time")
Example block output

1.2.4. Hospitalization rate.

plot(df.obstimes, df.wt,
+    title="Plot of Rt Over Time")
Example block output

1.2.4. Hospitalization rate.

plot(df.obstimes, df.wt,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Rt",
-    title="Plot of Hospitalization Rate Over Time")
Example block output

2. Alternate Functionality.

We can also use a prespecified effective repordcution number curve or a prespecified hospitaliation probability curve. Any combintation of presepcified or random walk curves can be used. Here we provide an example of using both a prespecified effective reproduction number curve and a prespecified hospitalization probability curve.

using UCIWWEIHR
+    title="Plot of Hospitalization Rate Over Time")
Example block output

2. Alternate Functionality.

We can also use a prespecified effective repordcution number curve or a prespecified hospitaliation probability curve. Any combintation of presepcified or random walk curves can be used. Here we provide an example of using both a prespecified effective reproduction number curve and a prespecified hospitalization probability curve.

using UCIWWEIHR
 using Plots
 # Running simulation function with prespecified Rt and hospitalization probability
 rt_custom = vcat(
@@ -45,20 +45,20 @@
     w = w_custom
 )
 df = generate_simulation_data_uciwweihr(params)
-first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.271684161.00.3
220.517405271.029630.302353
330.498941241.059260.304706
440.764782231.088890.307059
550.814226321.118520.309412

2.2 Visualizing UCIWWEIHR model results.

We can visualize these results using the Plots package.

2.2.1. Concentration of pathogen genome in wastewater(WW).

plot(df.obstimes, df.log_ww_conc,
+first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.347026181.00.3
220.550405261.029630.302353
330.503247291.059260.304706
440.885447361.088890.307059
550.794372281.118520.309412

2.2 Visualizing UCIWWEIHR model results.

We can visualize these results using the Plots package.

2.2.1. Concentration of pathogen genome in wastewater(WW).

plot(df.obstimes, df.log_ww_conc,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Conc. of Pathogen Genome in WW",
-    title="Plot of Conc. of Pathogen Genome in WW Over Time")
Example block output

2.2.2. Hospitalizations.

plot(df.obstimes, df.hosp,
+    title="Plot of Conc. of Pathogen Genome in WW Over Time")
Example block output

2.2.2. Hospitalizations.

plot(df.obstimes, df.hosp,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Hosp",
-    title="Plot of Hosp Over Time")
Example block output

2.2.3. Reproductive number.

plot(df.obstimes, df.rt,
+    title="Plot of Hosp Over Time")
Example block output

2.2.3. Reproductive number.

plot(df.obstimes, df.rt,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Rt",
-    title="Plot of Rt Over Time")
Example block output

2.2.4. Hospitalization rate.

plot(df.obstimes, df.wt,
+    title="Plot of Rt Over Time")
Example block output

2.2.4. Hospitalization rate.

plot(df.obstimes, df.wt,
     label=nothing,
     xlabel="Obstimes",
     ylabel="Rt",
-    title="Plot of Hospitalization Rate Over Time")
Example block output

Tutorial Contents

+ title="Plot of Hospitalization Rate Over Time")Example block output

Tutorial Contents

diff --git a/dev/tutorials/uciwwiehr_model_fitting_forecast/index.html b/dev/tutorials/uciwwiehr_model_fitting_forecast/index.html index 57fe7d3..b29e743 100644 --- a/dev/tutorials/uciwwiehr_model_fitting_forecast/index.html +++ b/dev/tutorials/uciwwiehr_model_fitting_forecast/index.html @@ -10,7 +10,7 @@ time_points = 178 ) df_ext = generate_simulation_data_uciwweihr(params_ext) -first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.271654260.997770.349492
220.517304161.014680.353323
330.498552250.9891190.347515
440.762967311.069040.365335
550.810309371.109150.373918
first(df_ext, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.271654280.997770.349492
220.517304301.014680.353323
330.498552330.9891190.347515
440.762967241.069040.365335
550.810309231.109150.373918

2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.

Here we sample from the posterior distribution using the uciwweihr_fit.jl function. First, we setup some presets, where we need to use create_uciwweihr_model_params() to get default parameters for the model. Then we have an array where index 1 contains the posterior/prior predictive samples, index 2 contains the posterior/prior generated quantities samples, and index 3 contains the original sampled parameters for the model. The difference here is that we set forecast = true and forecast_weeks = 4 to forecast 4 weeks into the future. One other thing to note, is that we allow misalignment of hospital and wastewater data's observed times. For this tutorial, we use the same observed points.

data_hosp = df.hosp
+first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.346996180.997770.349492
220.550305241.014680.353323
330.502858400.9891190.347515
440.883632311.069040.365335
550.790455331.109150.373918
first(df_ext, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.346996240.997770.349492
220.550305251.014680.353323
330.502858170.9891190.347515
440.883632291.069040.365335
550.790455261.109150.373918

2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.

Here we sample from the posterior distribution using the uciwweihr_fit.jl function. First, we setup some presets, where we need to use create_uciwweihr_model_params() to get default parameters for the model. Then we have an array where index 1 contains the posterior/prior predictive samples, index 2 contains the posterior/prior generated quantities samples, and index 3 contains the original sampled parameters for the model. The difference here is that we set forecast = true and forecast_weeks = 4 to forecast 4 weeks into the future. One other thing to note, is that we allow misalignment of hospital and wastewater data's observed times. For this tutorial, we use the same observed points.

data_hosp = df.hosp
 data_wastewater = df.log_ww_conc
 obstimes_hosp = df.obstimes
 obstimes_wastewater = df.obstimes
@@ -44,7 +44,7 @@
     forecast_weeks = forecast_weeks
 )
 
-first(model_output[1][:,1:5], 5)
5×5 DataFrame
RowiterationchainRt_params_non_centered[25]Rt_params_non_centered[26]Rt_params_non_centered[27]
Int64Int64Float64Float64Float64
111-0.7400520.631051-1.73773
221-0.7400520.631051-1.73773
331-0.7400520.631051-1.73773
441-0.7400520.631051-1.73773
551-0.7400520.631051-1.73773
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111218.40294.161321.7997
221223.088102.57117.9315
331229.77178.05922.7011
441191.911109.61815.3662
551209.63786.73226.2963
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
110110.368043-0.2919360.359946
210210.4617570.128528-0.413691
310310.595413-1.097050.540214
41041-0.1617820.480897-0.926751
510510.192742-0.6633981.25925

3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.

We can again look at model diagnostics, posterior distribution of time or non-time varying parameters, and the posterior predictive distribution extended for forecasting. We can also add certain parameters to ensure priors will be plotted alongside their corresponding posteriors.

uciwweihr_visualizer(
+first(model_output[1][:,1:5], 5)
5×5 DataFrame
RowiterationchainRt_params_non_centered[25]Rt_params_non_centered[26]Rt_params_non_centered[27]
Int64Int64Float64Float64Float64
111-0.7400520.631051-1.73773
221-0.7400520.631051-1.73773
331-0.7400520.631051-1.73773
441-0.7400520.631051-1.73773
551-0.7400520.631051-1.73773
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111235.24297.285816.7345
221185.432110.04222.9187
331177.815120.40119.0302
441208.828107.29519.9111
551189.612110.3620.7868
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
110110.704849-0.13571-0.653101
21021-0.2913510.5021080.583744
31031-0.4436941.02006-0.193954
410410.1765690.364738-0.0177813
51051-0.2077680.5180130.15736

3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.

We can again look at model diagnostics, posterior distribution of time or non-time varying parameters, and the posterior predictive distribution extended for forecasting. We can also add certain parameters to ensure priors will be plotted alongside their corresponding posteriors.

uciwweihr_visualizer(
     data_hosp,
     data_wastewater,
     forecast_weeks,
@@ -67,17 +67,17 @@
     plot_name_to_save_time_varying = "mcmc_time_varying_parameter_plots1",
     plot_name_to_save_non_time_varying = "mcmc_nontime_varying_parameter_plots1",
     plot_name_to_save_pred_param = "mcmc_pred_parameter_plots1"
-)
Effective Sample Size for E_init for Chain 1: 234.0
-Effective Sample Size for I_init for Chain 1: 283.0
+)
Effective Sample Size for E_init for Chain 1: 397.0
+Effective Sample Size for I_init for Chain 1: 460.0
 Effective Sample Size for H_init for Chain 1: 460.0
-Effective Sample Size for gamma for Chain 1: 170.0
-Effective Sample Size for nu for Chain 1: 159.0
-Effective Sample Size for epsilon for Chain 1: 206.0
-Effective Sample Size for rt_init for Chain 1: 195.0
-Effective Sample Size for w_init for Chain 1: 184.0
-Effective Sample Size for sigma_w for Chain 1: 176.0
-Effective Sample Size for sigma_Rt for Chain 1: 252.0
-Effective Sample Size for rho_gene for Chain 1: 228.0
+Effective Sample Size for gamma for Chain 1: 175.0
+Effective Sample Size for nu for Chain 1: 163.0
+Effective Sample Size for epsilon for Chain 1: 166.0
+Effective Sample Size for rt_init for Chain 1: 201.0
+Effective Sample Size for w_init for Chain 1: 223.0
+Effective Sample Size for sigma_w for Chain 1: 106.0
+Effective Sample Size for sigma_Rt for Chain 1: 283.0
+Effective Sample Size for rho_gene for Chain 1: 167.0
 Plot saved to plots/mcmc_diagnosis_plots1.png
 Generating time varying parameter plots (with priors and with wastewater)...
 Using uciwweihr_model with wastewater!!!
@@ -97,4 +97,4 @@
 Sampling (1 threads) 100%|██████████████████████████████| Time: 0:00:00
 Using uciwweihr_model with wastewater!!!
 Plot saved to plots/mcmc_nontime_varying_parameter_plots1.png
-Plot saved to plots/mcmc_pred_parameter_plots1.png

3.1. MCMC Diagnostic Plots.

Plot 1

3.2. Time Varying Parameter Results Plot.

Plot 2

3.3. Non-Time Varying Parameter Results Plot.

Plot 3

3.4. Posterior Predictive Distribution Plot.

Plot 4

Tutorial Contents

+Plot saved to plots/mcmc_pred_parameter_plots1.png

3.1. MCMC Diagnostic Plots.

Plot 1

3.2. Time Varying Parameter Results Plot.

Plot 2

3.3. Non-Time Varying Parameter Results Plot.

Plot 3

3.4. Posterior Predictive Distribution Plot.

Plot 4

Tutorial Contents

diff --git a/dev/tutorials/uciwwiehr_model_fitting_no_forecast/index.html b/dev/tutorials/uciwwiehr_model_fitting_no_forecast/index.html index 0e630c1..5878cfa 100644 --- a/dev/tutorials/uciwwiehr_model_fitting_no_forecast/index.html +++ b/dev/tutorials/uciwwiehr_model_fitting_no_forecast/index.html @@ -23,7 +23,7 @@ w = w_custom ) df = generate_simulation_data_uciwweihr(params) -first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.271684161.00.3
220.517405271.029630.302353
330.498941241.059260.304706
440.764782231.088890.307059
550.814226321.118520.309412

2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.

Here we sample from the posterior distribution using the uciwweihr_fit.jl function. First, we setup some presets, where we need to use create_uciwweihr_model_params() to get default parameters for the model. Then we have an array where index 1 contains the posterior/prior predictive samples, index 2 contains the posterior/prior generated quantities samples, and index 3 contains the original sampled parameters for the model. Again, we can allow misalignment of hospital and wastewater data's observed times. For this tutorial, we use the same observed points.

data_hosp = df.hosp
+first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.347026181.00.3
220.550405261.029630.302353
330.503247291.059260.304706
440.885447361.088890.307059
550.794372281.118520.309412

2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.

Here we sample from the posterior distribution using the uciwweihr_fit.jl function. First, we setup some presets, where we need to use create_uciwweihr_model_params() to get default parameters for the model. Then we have an array where index 1 contains the posterior/prior predictive samples, index 2 contains the posterior/prior generated quantities samples, and index 3 contains the original sampled parameters for the model. Again, we can allow misalignment of hospital and wastewater data's observed times. For this tutorial, we use the same observed points.

data_hosp = df.hosp
 data_wastewater = df.log_ww_conc
 obstimes_hosp = df.obstimes
 obstimes_wastewater = df.obstimes
@@ -55,7 +55,7 @@
     params = model_params
 )
 
-first(model_output[1][:,1:5], 5)
5×5 DataFrame
Rowiterationchaindata_wastewater[1]data_wastewater[2]data_wastewater[3]
Int64Int64Float64Float64Float64
1110.05218480.4264580.457273
2210.2226650.391490.540492
3310.2358120.4210570.568437
4410.2180370.3821790.30116
5510.6017850.5498690.685098
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111199.39682.765713.7541
221219.97176.204514.8032
331204.11979.900814.6696
441176.91789.654118.9959
551188.72397.846120.0366
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
11011-0.0120857-0.861717-1.24918
210210.399416-1.18978-1.03937
310310.0823789-1.00496-1.06607
41041-0.461668-0.517294-0.200811
51051-0.225531-0.1076970.00732892

3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.

We also provide a very basic way to visualize some MCMC diagnostics along with effective sample sizes of desired generated quantities(does not include functionality for time-varying quantities). Along with this, we can also visualize the posterior predictive distribution with actual observed values, which can be used to examine forecasts generated by the model. We can also add certain parameters to ensure priors will be plotted alongside their corresponding posteriors.

uciwweihr_visualizer(
+first(model_output[1][:,1:5], 5)
5×5 DataFrame
Rowiterationchaindata_wastewater[1]data_wastewater[2]data_wastewater[3]
Int64Int64Float64Float64Float64
1110.1910050.5169230.523955
2210.3941930.4993780.57682
3310.397920.5169960.43948
4410.319250.4061710.565214
5510.2270450.5354180.580886
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111180.302106.13118.0044
221183.43494.78419.5231
331184.061101.39822.6265
441176.035102.0323.125
551146.343115.26425.4501
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
11011-0.3939640.30655-0.399125
21021-0.331328-0.2608-0.0953729
31031-0.318770.06988620.5253
41041-0.4793030.10150.624991
51051-1.073150.7632151.09001

3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.

We also provide a very basic way to visualize some MCMC diagnostics along with effective sample sizes of desired generated quantities(does not include functionality for time-varying quantities). Along with this, we can also visualize the posterior predictive distribution with actual observed values, which can be used to examine forecasts generated by the model. We can also add certain parameters to ensure priors will be plotted alongside their corresponding posteriors.

uciwweihr_visualizer(
     data_hosp,
     data_wastewater,
     forecast_weeks,
@@ -74,17 +74,17 @@
     actual_non_time_varying_vals = params,
     bayes_dist_type = "Posterior",
     save_plots = true
-)
Effective Sample Size for E_init for Chain 1: 59.0
-Effective Sample Size for I_init for Chain 1: 57.0
-Effective Sample Size for H_init for Chain 1: 150.0
-Effective Sample Size for gamma for Chain 1: 45.0
-Effective Sample Size for nu for Chain 1: 55.0
-Effective Sample Size for epsilon for Chain 1: 58.0
-Effective Sample Size for rt_init for Chain 1: 41.0
-Effective Sample Size for w_init for Chain 1: 48.0
-Effective Sample Size for sigma_w for Chain 1: 54.0
-Effective Sample Size for sigma_Rt for Chain 1: 49.0
-Effective Sample Size for rho_gene for Chain 1: 33.0
+)
Effective Sample Size for E_init for Chain 1: 68.0
+Effective Sample Size for I_init for Chain 1: 58.0
+Effective Sample Size for H_init for Chain 1: 100.0
+Effective Sample Size for gamma for Chain 1: 39.0
+Effective Sample Size for nu for Chain 1: 33.0
+Effective Sample Size for epsilon for Chain 1: 47.0
+Effective Sample Size for rt_init for Chain 1: 65.0
+Effective Sample Size for w_init for Chain 1: 41.0
+Effective Sample Size for sigma_w for Chain 1: 51.0
+Effective Sample Size for sigma_Rt for Chain 1: 57.0
+Effective Sample Size for rho_gene for Chain 1: 60.0
 Plot saved to plots/mcmc_diagnosis_plots.png
 Generating time varying parameter plots (with priors and with wastewater)...
 Using uciwweihr_model with wastewater!!!
@@ -104,4 +104,4 @@
 Sampling (1 threads) 100%|██████████████████████████████| Time: 0:00:00
 Using uciwweihr_model with wastewater!!!
 Plot saved to plots/mcmc_nontime_varying_parameter_plots.png
-Plot saved to plots/mcmc_pred_parameter_plots.png

3.1. MCMC Diagnostic Plots.

Plot 1

3.2. Time Varying Parameter Results Plot.

Plot 2

3.3. Non-Time Varying Parameter Results Plot.

Plot 3

3.4. Posterior Predictive Distribution Plot.

Plot 4

Tutorial Contents

+Plot saved to plots/mcmc_pred_parameter_plots.png

3.1. MCMC Diagnostic Plots.

Plot 1

3.2. Time Varying Parameter Results Plot.

Plot 2

3.3. Non-Time Varying Parameter Results Plot.

Plot 3

3.4. Posterior Predictive Distribution Plot.

Plot 4

Tutorial Contents