diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index c90484c..d15f0d4 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-08-25T22:56:12","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-08-29T04:36:00","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index 0b167f7..d601c68 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("git@github.com:cbernalz/UCIWWEIHR.jl.git")
+Pkg.add("git@github.com:cbernalz/UCIWWEIHR.jl.git") diff --git a/dev/license/index.html b/dev/license/index.html index 8de53ec..877af84 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/objects.inv b/dev/objects.inv index 79424ae..6dc95c4 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/reference/index.html b/dev/reference/index.html index ecf2948..84550a9 100644 --- a/dev/reference/index.html +++ b/dev/reference/index.html @@ -1,4 +1,4 @@ -REFERENCE · UCIWWEIHR.jl

Reference

Contents

Index

UCIWWEIHR.uciwweihr_sim_paramsType
uciwweihr_sim_params

Struct for holding parameters used in the UCIWWEIHR ODE compartmental model simulation. Use create_uciwweihr_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_paramsMethod
create_uciwweihr_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

  • 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"]
  • bayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is "Posterior".
  • 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.
  • tau_sd::Float64=0.02: Standard deviation for the scale/variation of the log scale data.
  • log_tau_mean::Float64=log(0.1): Mean for the scale/variation of the log scale data on log scale itself.
  • df_shape::Float64=2.0: Shape parameter for the gamma distribution.
  • df_scale::Float64=10.0: Scale parameter for the gamma distribution.
  • sigma_hosp_sd::Float64=50.0: Standard deviation for the negative binomial distribution for hospital data.
  • sigma_hosp_mean::Float64=500.0: Mean for the negative binomial distribution for hospital data.
  • 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

  • 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"]
  • bayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is "Posterior".
  • 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.time_varying_param_visMethod
time_varying_param_vis(...)

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

Arguments

  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • actual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • actual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • time_varying_params: A list of time varying parameters to visualize. Default is ["rtvals", "wt"].
  • quantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].
  • 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 "mcmctimevaryingparameterplots".
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.
  • 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.
  • tau_sd::Float64=0.02: Standard deviation for the scale/variation of the log scale data.
  • log_tau_mean::Float64=log(0.1): Mean for the scale/variation of the log scale data on log scale itself.
  • df_shape::Float64=2.0: Shape parameter for the gamma distribution.
  • df_scale::Float64=10.0: Scale parameter for the gamma distribution.
  • sigma_hosp_sd::Float64=50.0: Standard deviation for the negative binomial distribution for hospital data.
  • sigma_hosp_mean::Float64=500.0: Mean for the negative binomial distribution for hospital data.
  • 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.
  • param_change_times::Array{Float64}: An array of timepoints where the parameters change.

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: An array of timepoints for observed hosp/wastewater.
  • param_change_times: An array of timepoints where the parameters change.
  • 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.
  • tau_sd::Float64=0.02: Standard deviation for the scale/variation of the log scale data.
  • log_tau_mean::Float64=log(0.1): Mean for the scale/variation of the log scale data on log scale itself.
  • df_shape::Float64=2.0: Shape parameter for the gamma distribution.
  • df_scale::Float64=10.0: Scale parameter for the gamma distribution.
  • sigma_hosp_sd::Float64=50.0: Standard deviation for the negative binomial distribution for hospital data.
  • sigma_hosp_mean::Float64=500.0: Mean for the negative binomial distribution for hospital data.
  • 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_visualizerMethod
uciwweihr_visualizer(...)

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

  • pp_sampeles: Posterior predictive samples from the posterior/prior distribution, index 1 in uciwweihrgqpp output.
  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • data_hosp: An array of hospital data.
  • data_wastewater: An array of pathogen genome concentration in localized wastewater data.
  • actual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • actual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • 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.
  • forecast_weeks: Number of weeks to forecasted. Default is 0.
  • 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"]].
  • time_varying_params: A list of time varying parameters to visualize. Default is ["rtvals", "wt"].
  • var_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 ("Posterior" / "Prior").
  • mcmcdaigs::Bool=true: A boolean to indicate if user wants to visualize mcmc diagnosis plots and Effective Sample Size(ESS).
  • time_varying_plots::Bool=true: A boolean to indicate if user wants to visualize time varying parameters.
  • non_time_varying_plots::Bool=true: A boolean to indicate if user wants to visualize non-time varying parameters.
  • pred_param_plots::Bool=true: A boolean to indicate if user wants to visualize posterior (or prior) predictive parameter results.
  • 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_mcmcdiag: A string to indicate the name of the plot to save for MCMC diagnostics. Default is "mcmcdiagnosisplots".
  • plot_name_to_save_time_varying: A string to indicate the name of the plot to save for time varying parameters. Default is "mcmctimevaryingparameterplots".
  • plot_name_to_save_non_time_varying: A string to indicate the name of the plot to save for non-time varying parameters. Default is "mcmcnontimevaryingparameterplots".
  • plot_name_to_save_pred_param: A string to indicate the name of the plot to save for posterior (or prior) predictive parameter results. Default is "mcmcpredparameter_plots".
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.time_varying_param_visMethod
time_varying_param_vis(...)

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

Arguments

  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • actual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • actual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • time_varying_params: A list of time varying parameters to visualize. Default is ["rtvals", "wt"].
  • quantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].
  • 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 "mcmctimevaryingparameterplots".
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: An array of timepoints for observed hosp/wastewater.
  • param_change_times: An array of timepoints where the parameters change.
  • params::uciwweihr_model_params: A struct containing parameters for the model.
source
UCIWWEIHR.uciwweihr_visualizerMethod
uciwweihr_visualizer(...)

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

  • pp_sampeles: Posterior predictive samples from the posterior/prior distribution, index 1 in uciwweihrgqpp output.
  • gq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.
  • data_hosp: An array of hospital data.
  • data_wastewater: An array of pathogen genome concentration in localized wastewater data.
  • actual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • actual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.
  • 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.
  • forecast_weeks: Number of weeks to forecasted. Default is 0.
  • 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"]].
  • time_varying_params: A list of time varying parameters to visualize. Default is ["rtvals", "wt"].
  • var_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 ("Posterior" / "Prior").
  • mcmcdaigs::Bool=true: A boolean to indicate if user wants to visualize mcmc diagnosis plots and Effective Sample Size(ESS).
  • time_varying_plots::Bool=true: A boolean to indicate if user wants to visualize time varying parameters.
  • non_time_varying_plots::Bool=true: A boolean to indicate if user wants to visualize non-time varying parameters.
  • pred_param_plots::Bool=true: A boolean to indicate if user wants to visualize posterior (or prior) predictive parameter results.
  • 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_mcmcdiag: A string to indicate the name of the plot to save for MCMC diagnostics. Default is "mcmcdiagnosisplots".
  • plot_name_to_save_time_varying: A string to indicate the name of the plot to save for time varying parameters. Default is "mcmctimevaryingparameterplots".
  • plot_name_to_save_non_time_varying: A string to indicate the name of the plot to save for non-time varying parameters. Default is "mcmcnontimevaryingparameterplots".
  • plot_name_to_save_pred_param: A string to indicate the name of the plot to save for posterior (or prior) predictive parameter results. Default is "mcmcpredparameter_plots".
source
diff --git a/dev/search_index.js b/dev/search_index.js index f2f4989..c0f8aca 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"tutorial_index/#tutorial_home","page":"TUTORIAL CONTENTS","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorial_index/","page":"TUTORIAL CONTENTS","title":"TUTORIAL CONTENTS","text":"Future Description.","category":"page"},{"location":"tutorial_index/#Contents","page":"TUTORIAL CONTENTS","title":"Contents","text":"","category":"section"},{"location":"tutorial_index/","page":"TUTORIAL CONTENTS","title":"TUTORIAL CONTENTS","text":"Getting Started\nGenerating simulated data with UCIWWEIHR ODE compartmental based model.\nGenerating simulated data with an agent based model.\nGenerating posterior distribution samples with UCIWWEIHR ODE compartmental based model without forecasting.\nGenerating posterior distribution samples with UCIWWEIHR ODE compartmental based model with forecasting.","category":"page"},{"location":"license/#license","page":"LICENSE","title":"UCIWWEIHR.jl Package License","text":"","category":"section"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"The UCIWWEIHR.jl package is licensed under the MIT License.","category":"page"},{"location":"license/#MIT-License","page":"LICENSE","title":"MIT License","text":"","category":"section"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"MIT License","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"Copyright (c) 2024 Christian O. Bernal Zelaya","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"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:","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"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.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"using Plots, StatsPlots; gr()\nPlots.reset_defaults()\n","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#uciwwiehr_model_fitting_with_forecast","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"Generating Posterior Distribution Samples with UCIWWEIHR ODE Compartmental Based Model with Forecasting.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"Here we extend the previous tutorial to include forecasting capabilities. We start with generating out data using generate_simulation_data_uciwweihr's alternate parameterization where we do not prespecify the effective reproduction number and hospitalization probability but instead preform a log-normal random walk and a logit-normal random walk respectively. We then sample from the posterior distribution using the uciwweihr_fit.jl function. We then generate desired quantities and forecast for a given time period with the posterior predictive distribution, using uciwweihr_gq_pp.jl.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#1.-Data-Generation.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"1. Data Generation.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"Here we generate two datasets, one with 150 time points and one with 178 time points. We will use the 150 time point dataset for fitting and the 178 time point dataset for forecast evaluation.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"using UCIWWEIHR\n# Running simulation function with presets\nparams = create_uciwweihr_params(\n time_points = 150\n)\ndf = generate_simulation_data_uciwweihr(params)\n\nparams_ext = create_uciwweihr_params(\n time_points = 178\n)\ndf_ext = generate_simulation_data_uciwweihr(params_ext)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"first(df_ext, 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#2.-Sampling-from-the-Posterior-Distribution-and-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"Here we sample from the posterior distribution using the uciwweihr_fit.jl function. First, we setup some presets, then 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 diference here is that we set forecast = true and forecast_weeks = 4 to forecast 4 weeks into the future.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"data_hosp = df.hosp\ndata_wastewater = df.log_ww_conc\nobstimes = df.obstimes\nparam_change_times = 1:7:length(obstimes) # Change every week\npriors_only = false\nn_samples = 50\nforecast = true\nforecast_weeks = 4\n\nsamples = uciwweihr_fit(\n data_hosp,\n data_wastewater;\n obstimes,\n param_change_times,\n priors_only,\n n_samples\n)\nmodel_output = uciwweihr_gq_pp(\n samples,\n data_hosp,\n data_wastewater;\n obstimes = obstimes,\n param_change_times = param_change_times,\n forecast = forecast,\n forecast_weeks = forecast_weeks\n)\n\nfirst(model_output[1][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"first(model_output[2][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"first(model_output[3][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.-MCMC-Diagnostic-Plots/Results-Along-with-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"We can again look at model diagnostics, posterior distribution of time or non-time varying parameters, and the posterior predictive distribution extended for forecasting.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"uciwweihr_visualizer(\n pp_samples = model_output[1],\n gq_samples = model_output[2],\n data_hosp = df_ext.hosp,\n data_wastewater = df_ext.log_ww_conc, \n actual_rt_vals = df_ext.rt, \n actual_w_t = df_ext.wt, \n actual_non_time_varying_vals = params,\n forecast_weeks = forecast_weeks,\n bayes_dist_type = \"Posterior\",\n save_plots = true,\n plot_name_to_save_mcmcdiag = \"mcmc_diagnosis_plots1\",\n plot_name_to_save_time_varying = \"mcmc_time_varying_parameter_plots1\",\n plot_name_to_save_non_time_varying = \"mcmc_nontime_varying_parameter_plots1\",\n plot_name_to_save_pred_param = \"mcmc_pred_parameter_plots1\"\n)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.1.-MCMC-Diagnostic-Plots.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.1. MCMC Diagnostic Plots.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 1)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.2.-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.2. Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 2)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.3.-Non-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.3. Non-Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 3)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.4.-Posterior-Predictive-Distribution-Plot.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.4. Posterior Predictive Distribution Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 4)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#[Tutorial-Contents](@ref-tutorial_home)","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/#agent_based_simulation_data","page":"AGENT-BASED SIMULATION DATA","title":"Generating simulated data with an agent based model.","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"This package provides a way to also simulate data using the agent based model in the future paper. The function called generate_simulation_data_agent.jl can be used to generate synthetic data for a given population size and features. Here we provide a demonstration using the default settings of generate_simulation_data_agent.jl :","category":"page"},{"location":"tutorials/agent_based_simulation_data/#1.-Functionality.","page":"AGENT-BASED SIMULATION DATA","title":"1. Functionality.","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"using UCIWWEIHR\nusing Plots\n# Running simulation function with defaults\ndf = generate_simulation_data_agent()\nfirst(df, 5)","category":"page"},{"location":"tutorials/agent_based_simulation_data/#2.-Visualizing-SEIHR-compartments.","page":"AGENT-BASED SIMULATION DATA","title":"2. Visualizing SEIHR compartments.","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"We can also use the Plots package to visualize the data generated.","category":"page"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"plot(df.Time, df.S, label = \"Suseptible\", \n xlabel = \"Time\", \n ylabel = \"Number of Individuals\", \n title = \"Agent Based Model Simulation Results\")\nplot!(df.Time, df.E, label = \"Exposed\")\nplot!(df.Time, df.I, label = \"Infected\")\nplot!(df.Time, df.H, label = \"Hospitalized\")\nplot!(df.Time, df.R, label = \"Recovered\")","category":"page"},{"location":"tutorials/agent_based_simulation_data/#[Tutorial-Contents](@ref-tutorial_home)","page":"AGENT-BASED SIMULATION DATA","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"using Plots, StatsPlots; gr()\nPlots.reset_defaults()\n","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#uciwwiehr_model_fitting_no_forecast","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"Generating Posterior Distribution Samples with UCIWWEIHR ODE Compartmental Based Model without Forecasting.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"This package has a way to sample from a posterior or prior that is defined in the future paper using the uciwweihr_fit.jl and uciwweihr_model.jl. We can then generate desired quantities and forecast for a given time period with the posterior predictive distribution, using uciwweihr_gq_pp.jl. We first generate data using the generate_simulation_data_uciwweihr function which is a non-mispecified version of the model, we will also be using prespecified effective reporduction curves and prespecified hospitalization probability curves.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#1.-Data-Generation.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"1. Data Generation.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"using UCIWWEIHR\n# Running simulation function with presets\nrt_custom = vcat(\n range(1, stop=1.8, length=7*4),\n fill(1.8, 7*2),\n range(1.8, stop=1, length=7*8),\n range(0.98, stop=0.8, length=7*2),\n range(0.8, stop=1.1, length=7*6),\n range(1.1, stop=0.97, length=7*3)\n)\nw_custom = vcat(\n range(0.3, stop=0.38, length=7*5),\n fill(0.38, 7*2),\n range(0.38, stop=0.25, length=7*8),\n range(0.25, stop=0.28, length=7*2),\n range(0.28, stop=0.34, length=7*6),\n range(0.34, stop=0.28, length=7*2)\n)\nparams = create_uciwweihr_params(\n time_points = length(rt_custom),\n Rt = rt_custom, \n w = w_custom\n)\ndf = generate_simulation_data_uciwweihr(params)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#2.-Sampling-from-the-Posterior-Distribution-and-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"Here we sample from the posterior distribution using the uciwweihr_fit.jl function. First, we setup some presets, then 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.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"data_hosp = df.hosp\ndata_wastewater = df.log_ww_conc\nobstimes = df.obstimes\nparam_change_times = 1:7:length(obstimes) # Change every week\npriors_only = false\nn_samples = 50\n\nsamples = uciwweihr_fit(\n data_hosp,\n data_wastewater;\n obstimes,\n param_change_times,\n priors_only,\n n_samples\n)\nmodel_output = uciwweihr_gq_pp(\n samples,\n data_hosp,\n data_wastewater;\n obstimes = obstimes,\n param_change_times = param_change_times,\n)\n\nfirst(model_output[1][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"first(model_output[2][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"first(model_output[3][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.-MCMC-Diagnostic-Plots/Results-Along-with-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"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.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"uciwweihr_visualizer(\n pp_samples = model_output[1],\n gq_samples = model_output[2],\n data_hosp = data_hosp,\n data_wastewater = data_wastewater, \n actual_rt_vals = df.rt, \n actual_w_t = df.wt, \n actual_non_time_varying_vals = params,\n bayes_dist_type = \"Posterior\",\n save_plots = true\n)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.1.-MCMC-Diagnostic-Plots.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.1. MCMC Diagnostic Plots.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 1)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.2.-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.2. Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 2)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.3.-Non-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.3. Non-Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 3)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.4.-Posterior-Predictive-Distribution-Plot.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.4. Posterior Predictive Distribution Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 4)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#[Tutorial-Contents](@ref-tutorial_home)","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorials/getting_started/#getting_started","page":"GETTING STARTED","title":"Getting Started","text":"","category":"section"},{"location":"tutorials/getting_started/","page":"GETTING STARTED","title":"GETTING STARTED","text":"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.","category":"page"},{"location":"tutorials/getting_started/#1.-Installation.","page":"GETTING STARTED","title":"1. Installation.","text":"","category":"section"},{"location":"tutorials/getting_started/","page":"GETTING STARTED","title":"GETTING STARTED","text":"To install the UCIWWEIHR.jl package, open the Julia REPL and run the following command:","category":"page"},{"location":"tutorials/getting_started/","page":"GETTING STARTED","title":"GETTING STARTED","text":"using Pkg\nPkg.add(\"git@github.com:cbernalz/UCIWWEIHR.jl.git\")","category":"page"},{"location":"tutorials/getting_started/#[Tutorial-Contents](@ref-tutorial_home)","page":"GETTING STARTED","title":"Tutorial Contents","text":"","category":"section"},{"location":"reference/#reference","page":"REFERENCE","title":"Reference","text":"","category":"section"},{"location":"reference/#Contents","page":"REFERENCE","title":"Contents","text":"","category":"section"},{"location":"reference/","page":"REFERENCE","title":"REFERENCE","text":"Pages = [\"reference.md\"]","category":"page"},{"location":"reference/#Index","page":"REFERENCE","title":"Index","text":"","category":"section"},{"location":"reference/","page":"REFERENCE","title":"REFERENCE","text":"Pages = [\"reference.md\"]","category":"page"},{"location":"reference/","page":"REFERENCE","title":"REFERENCE","text":"Modules = [UCIWWEIHR]","category":"page"},{"location":"reference/#UCIWWEIHR.uciwweihr_sim_params","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_sim_params","text":"uciwweihr_sim_params\n\nStruct for holding parameters used in the UCIWWEIHR ODE compartmental model simulation. Use create_uciwweihr_params to create an instance of this struct.\n\nFields\n\ntime_points::Int64: Number of time points for the simulation.\nseed::Int64: Seed for random number generation.\nE_init::Int64: Initial number of exposed individuals.\nI_init::Int64: Initial number of infected individuals.\nH_init::Int64: Initial number of hospitalized individuals.\ngamma::Float64: Rate of incubation.\nnu::Float64: Rate of leaving the infected compartment.\nepsilon::Float64: Rate of hospitalization recovery.\nrho_gene::Float64: Contribution of infected individual's pathogen genome into wastewater.\ntau::Float64: Scale/variation of the log concentration of pathogen genome in wastewater.\ndf::Float64: Degrees of freedom for generalized t-distribution for log concentration of pathogen genome in wastewater.\nsigma_hosp::Float64: Standard deviation for the negative binomial distribution for hospital data.\nRt::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying reproduction number.\nsigma_Rt::Float64: Standard deviation for random walk of time-varying reproduction number.\nw::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying hospitalization rate.\nsigma_w::Float64: Standard deviation for random walk of time-varying hospitalization rate.\nrt_init::Float64: Initial value of the time-varying reproduction number, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.\nw_init::Float64: Initial value of the time-varying hospitalization rate, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.\n\n\n\n\n\n","category":"type"},{"location":"reference/#UCIWWEIHR.ChainsCustomIndex-Tuple{MCMCChains.Chains, BitMatrix}","page":"REFERENCE","title":"UCIWWEIHR.ChainsCustomIndex","text":"ChainsCustomIndex(c::Chains, indices_to_keep::BitMatrix)\n\nReduce Chains object to only wanted indices. \n\nFunction created by Damon Bayer. \n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.NegativeBinomial2-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.NegativeBinomial2","text":"Create a re-parametrized negative binomial distribution in terms of mean and overdispersion.\n\nArguments\n\nμ: Mean of the distribution.\nϕ: Overdispersion parameter.\n\nReturns\n\nA Distributions.NegativeBinomial distribution object.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.calculate_quantiles-NTuple{4, Any}","page":"REFERENCE","title":"UCIWWEIHR.calculate_quantiles","text":"calculate_quantiles(df, chain, var_prefix, quantiles)\n\nCalculate quantiles for a given chain and variable prefix. Quantiles can be any user desired quantile.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.create_uciwweihr_params-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.create_uciwweihr_params","text":"create_uciwweihr_params(; kwargs...)\n\nCreates a uciwweihr_sim_params struct with the option to either use a predetermined Rt and w or generate them as random walks.\n\nArguments\n\nkwargs...: Named arguments corresponding to the fields in uciwweihr_sim_params.\n\nReturns\n\nparams::uciwweihr_sim_params: A struct with simulation parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.eihr_ode!-NTuple{4, Any}","page":"REFERENCE","title":"UCIWWEIHR.eihr_ode!","text":"eihr_ode!(du, u, p, t)\n\nCalculate the ordinary differential equations (ODEs) for the EIHR model.\n\nParameters:\n\ndu: Array{Float64,1} - The derivative of the state variables.\nu: Array{Float64,1} - The current state variables.\np: Tuple{Float64,Float64,Float64,Float64,Float64} - The model parameters (alpha, gamma, nu, w, epsilon).\nt: Float64 - The current time.\n\nReturns:\n\ndu: Array{Float64,1} - The derivative of the state variables.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_colors-Tuple{Any}","page":"REFERENCE","title":"UCIWWEIHR.generate_colors","text":"generate_ribbon_colors(number_of_colors)\n\nGenerates a vector with colors for ribbons in plots.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_logit_normal_random_walk-Tuple{Int64, Float64, Float64}","page":"REFERENCE","title":"UCIWWEIHR.generate_logit_normal_random_walk","text":"generate_logit_normal_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)\n\nGenerates a logit-normal random walk time series.\n\nArguments\n\ntime_points::Int64: Number of time points.\nsigma::Float64: Standard deviation of the random walk in logit space.\ninit_val::Float64: Initial value of the random walk on the probability scale.\n\nReturns\n\nwalk::Vector{Float64}: Generated random walk on the probability scale.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_random_walk-Tuple{Int64, Float64, Float64}","page":"REFERENCE","title":"UCIWWEIHR.generate_random_walk","text":"generate_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)\n\nGenerates a random walk time series.\n\nArguments\n\ntime_points::Int64: Number of time points.\nsigma::Float64: Standard deviation of the random walk.\ninit_val::Float64: Initial value of the random walk.\n\nReturns\n\nwalk::Vector{Float64}: Generated random walk.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_simulation_data_agent","page":"REFERENCE","title":"UCIWWEIHR.generate_simulation_data_agent","text":"Generating Simulation Data for Agent Based Model\n\nTo 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\n\nFunction Signature\n\nArguments\n\nseed::Int64: Seed for random number generation. Default value is 1.\npop_size::Int64: Size of the population. Default value is 1000.\nI_init::Int64: Initial number of infected individuals. Default value is 200.\nH_init::Int64: Initial number of hospitalized individuals. Default value is 20.\nbeta::Float64: Transmission rate. Default value is 0.001.\ngamma::Float64: Rate of exposed individuals becoming infectious. Default value is 1/4.\nnu::Float64: Rate of infected individuals recovering or getting hospitalized. Default value is 1/7.\nepsilon::Float64: Rate of hospitalized individuals recovering. Default value is 1/5.\nw_init::Float64: Probability of an infected individual becoming hospitalized. Default value is 0.35.\n\nReturns\n\ndf::DataFrame: A DataFrame containing the simulation data with columns Time, S, E, I, H, and R.\n\n\n\n\n\n","category":"function"},{"location":"reference/#UCIWWEIHR.generate_simulation_data_uciwweihr-Tuple{uciwweihr_sim_params}","page":"REFERENCE","title":"UCIWWEIHR.generate_simulation_data_uciwweihr","text":"generate_simulation_data(params::UCIWWEIHRParams)\n\nGenerates simulation data for the UCIWWEIHR ODE compartmental model.\n\nArguments\n\nparams::uciwweihr_sim_params: Struct containing parameters for the simulation.\n\nReturns\n\ndf::DataFrame: A DataFrame containing the simulation data with columns obstimes, log_ww_conc, hosp, rt, and wt.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.mcmcdiags_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.mcmcdiags_vis","text":"mcmcdiags_vis(...)\n\nDefault 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.\n\nArguments\n\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\ndesired_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\"]].\nactual_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.\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmcdiagnosisplots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.non_time_varying_param_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.non_time_varying_param_vis","text":"non_time_varying_param_vis(...)\n\nUsed in the uciwweihr_visualizer to create visuals for non-time varying parameters.\n\nArguments\n\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\ndesired_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\"]\nbayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is \"Posterior\".\nactual_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.\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmcnontimevaryingparameterplots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.power-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.power","text":"power(a,b)\n\nRaise `a` to the `b` power\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.predictive_param_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.predictive_param_vis","text":"predictive_param_vis(...)\n\nUsed in the uciwweihr_visualizer to create visuals for wastewater data and hospitalization data.\n\nArguments\n\npp_samples: A DataFrame of posterior or prior predictive samples.\ndata_wastewater: An array of actual wastewater values if user has access to them assumed, using time scale of observed time points. Default is nothing.\ndata_hosp: An array of actual hospitalization values if user has access to them assumed, , using time scale of observed time points. Default is nothing.\nforecast_weeks: An integer of the number of weeks forecasted. Default is 0.\nvars_to_pred: A list of variables to predict. Default is [\"datawastewater\", \"datahosp\"].\nquantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].\nbayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is \"Posterior\".\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmcpredparameter_plots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.repeat_last_n_elements-Union{Tuple{T}, Tuple{Vector{T}, Int64, Int64}} where T","page":"REFERENCE","title":"UCIWWEIHR.repeat_last_n_elements","text":"repeat_last_n_elements(x::Vector{T}, n::Int, w::Int) where T\n\nModifies a given array so that the last n elements are repeated w times.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.save_plots_to_docs-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.save_plots_to_docs","text":"save_plots_to_docs(plot, filename; format = \"png\")\n\nSaves plots to docs/plots directory.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.startswith_any-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.startswith_any","text":"startswith_any(name, patterns)\n\nChecks if the name of time varying paramter starts with any of the patterns.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.time_varying_param_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.time_varying_param_vis","text":"time_varying_param_vis(...)\n\nUsed in the uciwweihr_visualizer to create visuals for time varying parameters.\n\nArguments\n\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\nactual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\nactual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\ntime_varying_params: A list of time varying parameters to visualize. Default is [\"rtvals\", \"wt\"].\nquantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmctimevaryingparameterplots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.uciwweihr_fit-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_fit","text":"uciwweihr_fit(...)\n\nThis 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.\n\nArguments\n\ndata_hosp: An array of hospital data.\ndata_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.\nobstimes: An array of timepoints for observed hosp/wastewater.\npriors_only::Bool=false: A boolean to indicate if only priors are to be sampled.\nn_samples::Int64=500: Number of samples to be drawn.\nn_chains::Int64=1: Number of chains to be run.\nseed::Int64=2024: Seed for the random number generator.\nE_init_sd::Float64=50.0: Standard deviation for the initial number of exposed individuals.\nE_init_mean::Int64=200: Mean for the initial number of exposed individuals.\nI_init_sd::Float64=20.0: Standard deviation for the initial number of infected individuals.\nI_init_mean::Int64=100: Mean for the initial number of infected individuals.\nH_init_sd::Float64=5.0: Standard deviation for the initial number of hospitalized individuals.\nH_init_mean::Int64=20: Mean for the initial number of hospitalized individuals.\ngamma_sd::Float64=0.02: Standard deviation for the rate of incubation.\nlog_gamma_mean::Float64=log(1/4): Mean for the rate of incubation on log scale.\nnu_sd::Float64=0.02: Standard deviation for the rate of leaving the infected compartment.\nlog_nu_mean::Float64=log(1/7): Mean for the rate of leaving the infected compartment on the log scale.\nepsilon_sd::Float64=0.02: Standard deviation for the rate of hospitalization recovery.\nlog_epsilon_mean::Float64=log(1/5): Mean for the rate of hospitalization recovery on the log scale.\nrho_gene_sd::Float64=0.02: Standard deviation for the rho prior.\nlog_rho_gene_mean::Float64=log(0.011): Mean for the row prior on log scale.\ntau_sd::Float64=0.02: Standard deviation for the scale/variation of the log scale data.\nlog_tau_mean::Float64=log(0.1): Mean for the scale/variation of the log scale data on log scale itself.\ndf_shape::Float64=2.0: Shape parameter for the gamma distribution.\ndf_scale::Float64=10.0: Scale parameter for the gamma distribution.\nsigma_hosp_sd::Float64=50.0: Standard deviation for the negative binomial distribution for hospital data.\nsigma_hosp_mean::Float64=500.0: Mean for the negative binomial distribution for hospital data.\nRt_init_sd::Float64=0.3: Standard deviation for the initial value of the time-varying reproduction number.\nRt_init_mean::Float64=0.2: Mean for the initial value of the time-varying reproduction number.\nsigma_Rt_sd::Float64=0.2: Standard deviation for normal prior of log time-varying reproduction number standard deviation.\nsigma_Rt_mean::Float64=-3.0: Mean for normal prior of log time-varying reproduction number standard deviation.\nw_init_sd::Float64=0.1: Standard deviation for the initial value of the time-varying hospitalization rate.\nw_init_mean::Float64=log(0.35): Mean for the initial value of the time-varying hospitalization rate.\nsigma_w_sd::Float64=0.2: Standard deviation for normal prior of log time-varying hospitalization rate standard deviation.\nsigma_w_mean::Float64=-3.5: Mean for normal prior of time-varying hospitalization rate standard deviation.\nparam_change_times::Array{Float64}: An array of timepoints where the parameters change.\n\nReturns\n\nSamples from the posterior or prior distribution.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.uciwweihr_model-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_model","text":"uciwweihr_model(...)\n\nThis 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.\n\nArguments\n\ndata_hosp: An array of hospital data.\ndata_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.\nobstimes: An array of timepoints for observed hosp/wastewater.\nparam_change_times: An array of timepoints where the parameters change.\nE_init_sd::Float64=50.0: Standard deviation for the initial number of exposed individuals.\nE_init_mean::Int64=200: Mean for the initial number of exposed individuals.\nI_init_sd::Float64=20.0: Standard deviation for the initial number of infected individuals.\nI_init_mean::Int64=100: Mean for the initial number of infected individuals.\nH_init_sd::Float64=5.0: Standard deviation for the initial number of hospitalized individuals.\nH_init_mean::Int64=20: Mean for the initial number of hospitalized individuals.\ngamma_sd::Float64=0.02: Standard deviation for the rate of incubation.\nlog_gamma_mean::Float64=log(1/4): Mean for the rate of incubation on log scale.\nnu_sd::Float64=0.02: Standard deviation for the rate of leaving the infected compartment.\nlog_nu_mean::Float64=log(1/7): Mean for the rate of leaving the infected compartment on the log scale.\nepsilon_sd::Float64=0.02: Standard deviation for the rate of hospitalization recovery.\nlog_epsilon_mean::Float64=log(1/5): Mean for the rate of hospitalization recovery on the log scale.\nrho_gene_sd::Float64=0.02: Standard deviation for the rho prior.\nlog_rho_gene_mean::Float64=log(0.011): Mean for the row prior on log scale.\ntau_sd::Float64=0.02: Standard deviation for the scale/variation of the log scale data.\nlog_tau_mean::Float64=log(0.1): Mean for the scale/variation of the log scale data on log scale itself.\ndf_shape::Float64=2.0: Shape parameter for the gamma distribution.\ndf_scale::Float64=10.0: Scale parameter for the gamma distribution.\nsigma_hosp_sd::Float64=50.0: Standard deviation for the negative binomial distribution for hospital data.\nsigma_hosp_mean::Float64=500.0: Mean for the negative binomial distribution for hospital data.\nRt_init_sd::Float64=0.3: Standard deviation for the initial value of the time-varying reproduction number.\nRt_init_mean::Float64=0.2: Mean for the initial value of the time-varying reproduction number.\nsigma_Rt_sd::Float64=0.2: Standard deviation for normal prior of log time-varying reproduction number standard deviation.\nsigma_Rt_mean::Float64=-3.0: Mean for normal prior of log time-varying reproduction number standard deviation.\nw_init_sd::Float64=0.1: Standard deviation for the initial value of the time-varying hospitalization rate.\nw_init_mean::Float64=log(0.35): Mean for the initial value of the time-varying hospitalization rate.\nsigma_w_sd::Float64=0.2: Standard deviation for normal prior of log time-varying hospitalization rate standard deviation.\nsigma_w_mean::Float64=-3.5: Mean for normal prior of time-varying hospitalization rate standard deviation.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.uciwweihr_visualizer-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_visualizer","text":"uciwweihr_visualizer(...)\n\nDefault 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.\n\nArguments\n\npp_sampeles: Posterior predictive samples from the posterior/prior distribution, index 1 in uciwweihrgqpp output.\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\ndata_hosp: An array of hospital data.\ndata_wastewater: An array of pathogen genome concentration in localized wastewater data.\nactual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\nactual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\nactual_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.\nforecast_weeks: Number of weeks to forecasted. Default is 0.\ndesired_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\"]].\ntime_varying_params: A list of time varying parameters to visualize. Default is [\"rtvals\", \"wt\"].\nvar_to_pred: A list of variables to predict. Default is [\"datawastewater\", \"datahosp\"].\nquantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].\nbayes_dist_type: A string to indicate if user is using Posterior or Prior distribution (\"Posterior\" / \"Prior\").\nmcmcdaigs::Bool=true: A boolean to indicate if user wants to visualize mcmc diagnosis plots and Effective Sample Size(ESS).\ntime_varying_plots::Bool=true: A boolean to indicate if user wants to visualize time varying parameters. \nnon_time_varying_plots::Bool=true: A boolean to indicate if user wants to visualize non-time varying parameters.\npred_param_plots::Bool=true: A boolean to indicate if user wants to visualize posterior (or prior) predictive parameter results.\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save_mcmcdiag: A string to indicate the name of the plot to save for MCMC diagnostics. Default is \"mcmcdiagnosisplots\".\nplot_name_to_save_time_varying: A string to indicate the name of the plot to save for time varying parameters. Default is \"mcmctimevaryingparameterplots\".\nplot_name_to_save_non_time_varying: A string to indicate the name of the plot to save for non-time varying parameters. Default is \"mcmcnontimevaryingparameterplots\".\nplot_name_to_save_pred_param: A string to indicate the name of the plot to save for posterior (or prior) predictive parameter results. Default is \"mcmcpredparameter_plots\".\n\n\n\n\n\n","category":"method"},{"location":"tutorials/uciwweihr_simulation_data/#uciwweihr_simulation_data","page":"UCIWWEIHR SIMULATION DATA","title":"Generating simulated data with UCIWWEIHR ODE compartmental based model.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"This package provides a way to also simulate data using the UCIWWEIHR ODE compartmental based model specified in the future paper. The function called generate_simulation_data_uciwweihr.jl can be used to generate synthetic data for a given number of samples and features. Here we provide a demonstration using the default settings of generate_simulation_data_uciwweihr.jl :","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.-Functionality.","page":"UCIWWEIHR SIMULATION DATA","title":"1. Functionality.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"using UCIWWEIHR\nusing Plots\n# Running simulation function with defaults\nparams = create_uciwweihr_params()\ndf = generate_simulation_data_uciwweihr(params)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2-Visualizing-UCIWWEIHR-model-results.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2 Visualizing UCIWWEIHR model results.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"Here we can make simple plots to visualize the data generated using the Plots package.","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.1.-Concentration-of-pathogen-genome-in-wastewater(WW).","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.1. Concentration of pathogen genome in wastewater(WW).","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.log_ww_conc,\n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Conc. of Pathogen Genome in WW\", \n title=\"Plot of Conc. of Pathogen Genome in WW Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.2.-Hospitalizations.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.2. Hospitalizations.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.hosp, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Hosp\", \n title=\"Plot of Hosp Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.3.-Reproductive-number.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.3. Reproductive number.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.rt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Rt Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.4.-Hospitalization-rate.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.4. Hospitalization rate.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.wt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Hospitalization Rate Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.-Alternate-Functionality.","page":"UCIWWEIHR SIMULATION DATA","title":"2. Alternate Functionality.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"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.","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"using UCIWWEIHR\nusing Plots\n# Running simulation function with prespecified Rt and hospitalization probability\nrt_custom = vcat(\n range(1, stop=1.8, length=7*4),\n fill(1.8, 7*2),\n range(1.8, stop=1, length=7*8),\n range(0.98, stop=0.8, length=7*2),\n range(0.8, stop=1.1, length=7*6),\n range(1.1, stop=0.97, length=7*3)\n)\nw_custom = vcat(\n range(0.3, stop=0.38, length=7*5),\n fill(0.38, 7*2),\n range(0.38, stop=0.25, length=7*8),\n range(0.25, stop=0.28, length=7*2),\n range(0.28, stop=0.34, length=7*6),\n range(0.34, stop=0.28, length=7*2)\n)\nparams = create_uciwweihr_params(\n time_points = length(rt_custom),\n Rt = rt_custom, \n w = w_custom\n)\ndf = generate_simulation_data_uciwweihr(params)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2-Visualizing-UCIWWEIHR-model-results.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2 Visualizing UCIWWEIHR model results.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"We can visualize these results using the Plots package.","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.1.-Concentration-of-pathogen-genome-in-wastewater(WW).","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.1. Concentration of pathogen genome in wastewater(WW).","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.log_ww_conc,\n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Conc. of Pathogen Genome in WW\", \n title=\"Plot of Conc. of Pathogen Genome in WW Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.2.-Hospitalizations.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.2. Hospitalizations.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.hosp, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Hosp\", \n title=\"Plot of Hosp Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.3.-Reproductive-number.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.3. Reproductive number.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.rt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Rt Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.4.-Hospitalization-rate.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.4. Hospitalization rate.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.wt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Hospitalization Rate Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#[Tutorial-Contents](@ref-tutorial_home)","page":"UCIWWEIHR SIMULATION DATA","title":"Tutorial Contents","text":"","category":"section"},{"location":"#UCIWWEIHR.jl","page":"HOME","title":"UCIWWEIHR.jl","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"Welcome to the UCIWWEIHR.jl package documentation! CURRENTLY UNDER DEVELOPMENT!!!","category":"page"},{"location":"","page":"HOME","title":"HOME","text":"By : Christian O. Bernal Zelaya & Volodymyr M. Minin.","category":"page"},{"location":"#Introduction","page":"HOME","title":"Introduction","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"UCIWWEIHR.jl is a Julia package for forecasting and nowcasting COVID-19 hospitalizations using pathogen genome concentrations. UCIWWEIHR.jl Package License","category":"page"},{"location":"#Features","page":"HOME","title":"Features","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"Comprehensive library of Bayesian models\nSimulation of infectious disease \nModel calibration\nSensitivity analysis and uncertainty quantification?\nVisualization of results and MCMC evaluations(live?)","category":"page"},{"location":"#Installation","page":"HOME","title":"Installation","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"To install UCIWWEIHR.jl, you can use the Julia package manager. Open the Julia REPL and run the following command:","category":"page"},{"location":"","page":"HOME","title":"HOME","text":"using Pkg\nPkg.add(\"git@github.com:cbernalz/UCIWWEIHR.jl.git\")","category":"page"}] +[{"location":"tutorial_index/#tutorial_home","page":"TUTORIAL CONTENTS","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorial_index/","page":"TUTORIAL CONTENTS","title":"TUTORIAL CONTENTS","text":"Future Description.","category":"page"},{"location":"tutorial_index/#Contents","page":"TUTORIAL CONTENTS","title":"Contents","text":"","category":"section"},{"location":"tutorial_index/","page":"TUTORIAL CONTENTS","title":"TUTORIAL CONTENTS","text":"Getting Started\nGenerating simulated data with UCIWWEIHR ODE compartmental based model.\nGenerating simulated data with an agent based model.\nGenerating posterior distribution samples with UCIWWEIHR ODE compartmental based model without forecasting.\nGenerating posterior distribution samples with UCIWWEIHR ODE compartmental based model with forecasting.","category":"page"},{"location":"license/#license","page":"LICENSE","title":"UCIWWEIHR.jl Package License","text":"","category":"section"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"The UCIWWEIHR.jl package is licensed under the MIT License.","category":"page"},{"location":"license/#MIT-License","page":"LICENSE","title":"MIT License","text":"","category":"section"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"MIT License","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"Copyright (c) 2024 Christian O. Bernal Zelaya","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"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:","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.","category":"page"},{"location":"license/","page":"LICENSE","title":"LICENSE","text":"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.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"using Plots, StatsPlots; gr()\nPlots.reset_defaults()\n","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#uciwwiehr_model_fitting_with_forecast","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"Generating Posterior Distribution Samples with UCIWWEIHR ODE Compartmental Based Model with Forecasting.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"Here we extend the previous tutorial to include forecasting capabilities. We start with generating out data using generate_simulation_data_uciwweihr's alternate parameterization where we do not prespecify the effective reproduction number and hospitalization probability but instead preform a log-normal random walk and a logit-normal random walk respectively. We then sample from the posterior distribution using the uciwweihr_fit.jl function. We then generate desired quantities and forecast for a given time period with the posterior predictive distribution, using uciwweihr_gq_pp.jl.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#1.-Data-Generation.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"1. Data Generation.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"Here we generate two datasets, one with 150 time points and one with 178 time points. We will use the 150 time point dataset for fitting and the 178 time point dataset for forecast evaluation.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"using UCIWWEIHR\n# Running simulation function with presets\nparams = create_uciwweihr_sim_params(\n time_points = 150\n)\ndf = generate_simulation_data_uciwweihr(params)\n\nparams_ext = create_uciwweihr_sim_params(\n time_points = 178\n)\ndf_ext = generate_simulation_data_uciwweihr(params_ext)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"first(df_ext, 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#2.-Sampling-from-the-Posterior-Distribution-and-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"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.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"data_hosp = df.hosp\ndata_wastewater = df.log_ww_conc\nobstimes = df.obstimes\nparam_change_times = 1:7:length(obstimes) # Change every week\npriors_only = false\nn_samples = 200\nforecast = true\nforecast_weeks = 4\n\nmodel_params = create_uciwweihr_model_params()\nsamples = uciwweihr_fit(\n data_hosp,\n data_wastewater;\n obstimes,\n param_change_times,\n priors_only,\n n_samples,\n params = model_params\n)\nmodel_output = uciwweihr_gq_pp(\n samples,\n data_hosp,\n data_wastewater;\n obstimes = obstimes,\n param_change_times = param_change_times,\n params = model_params,\n forecast = forecast,\n forecast_weeks = forecast_weeks\n)\n\nfirst(model_output[1][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"first(model_output[2][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"first(model_output[3][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.-MCMC-Diagnostic-Plots/Results-Along-with-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"We can again look at model diagnostics, posterior distribution of time or non-time varying parameters, and the posterior predictive distribution extended for forecasting.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"uciwweihr_visualizer(\n pp_samples = model_output[1],\n gq_samples = model_output[2],\n data_hosp = df_ext.hosp,\n data_wastewater = df_ext.log_ww_conc, \n actual_rt_vals = df_ext.rt, \n actual_w_t = df_ext.wt, \n actual_non_time_varying_vals = params,\n forecast_weeks = forecast_weeks,\n bayes_dist_type = \"Posterior\",\n save_plots = true,\n plot_name_to_save_mcmcdiag = \"mcmc_diagnosis_plots1\",\n plot_name_to_save_time_varying = \"mcmc_time_varying_parameter_plots1\",\n plot_name_to_save_non_time_varying = \"mcmc_nontime_varying_parameter_plots1\",\n plot_name_to_save_pred_param = \"mcmc_pred_parameter_plots1\"\n)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.1.-MCMC-Diagnostic-Plots.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.1. MCMC Diagnostic Plots.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 1)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.2.-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.2. Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 2)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.3.-Non-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.3. Non-Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 3)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#3.4.-Posterior-Predictive-Distribution-Plot.","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"3.4. Posterior Predictive Distribution Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"UCIWWEIHR FITTING MODEL W/ FORECASTING","text":"(Image: Plot 4)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_forecast/#[Tutorial-Contents](@ref-tutorial_home)","page":"UCIWWEIHR FITTING MODEL W/ FORECASTING","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/#agent_based_simulation_data","page":"AGENT-BASED SIMULATION DATA","title":"Generating simulated data with an agent based model.","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"This package provides a way to also simulate data using the agent based model in the future paper. The function called generate_simulation_data_agent.jl can be used to generate synthetic data for a given population size and features. Here we provide a demonstration using the default settings of generate_simulation_data_agent.jl :","category":"page"},{"location":"tutorials/agent_based_simulation_data/#1.-Functionality.","page":"AGENT-BASED SIMULATION DATA","title":"1. Functionality.","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"using UCIWWEIHR\nusing Plots\n# Running simulation function with defaults\ndf = generate_simulation_data_agent()\nfirst(df, 5)","category":"page"},{"location":"tutorials/agent_based_simulation_data/#2.-Visualizing-SEIHR-compartments.","page":"AGENT-BASED SIMULATION DATA","title":"2. Visualizing SEIHR compartments.","text":"","category":"section"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"We can also use the Plots package to visualize the data generated.","category":"page"},{"location":"tutorials/agent_based_simulation_data/","page":"AGENT-BASED SIMULATION DATA","title":"AGENT-BASED SIMULATION DATA","text":"plot(df.Time, df.S, label = \"Suseptible\", \n xlabel = \"Time\", \n ylabel = \"Number of Individuals\", \n title = \"Agent Based Model Simulation Results\")\nplot!(df.Time, df.E, label = \"Exposed\")\nplot!(df.Time, df.I, label = \"Infected\")\nplot!(df.Time, df.H, label = \"Hospitalized\")\nplot!(df.Time, df.R, label = \"Recovered\")","category":"page"},{"location":"tutorials/agent_based_simulation_data/#[Tutorial-Contents](@ref-tutorial_home)","page":"AGENT-BASED SIMULATION DATA","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"using Plots, StatsPlots; gr()\nPlots.reset_defaults()\n","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#uciwwiehr_model_fitting_no_forecast","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"Generating Posterior Distribution Samples with UCIWWEIHR ODE Compartmental Based Model without Forecasting.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"This package has a way to sample from a posterior or prior that is defined in the future paper using the uciwweihr_fit.jl and uciwweihr_model.jl. We can then generate desired quantities and forecast for a given time period with the posterior predictive distribution, using uciwweihr_gq_pp.jl. We first generate data using the generate_simulation_data_uciwweihr function which is a non-mispecified version of the model, we will also be using prespecified effective reporduction curves and prespecified hospitalization probability curves.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#1.-Data-Generation.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"1. Data Generation.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"using UCIWWEIHR\n# Running simulation function with presets\nrt_custom = vcat(\n range(1, stop=1.8, length=7*4),\n fill(1.8, 7*2),\n range(1.8, stop=1, length=7*8),\n range(0.98, stop=0.8, length=7*2),\n range(0.8, stop=1.1, length=7*6),\n range(1.1, stop=0.97, length=7*3)\n)\nw_custom = vcat(\n range(0.3, stop=0.38, length=7*5),\n fill(0.38, 7*2),\n range(0.38, stop=0.25, length=7*8),\n range(0.25, stop=0.28, length=7*2),\n range(0.28, stop=0.34, length=7*6),\n range(0.34, stop=0.28, length=7*2)\n)\nparams = create_uciwweihr_sim_params(\n time_points = length(rt_custom),\n Rt = rt_custom, \n w = w_custom\n)\ndf = generate_simulation_data_uciwweihr(params)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#2.-Sampling-from-the-Posterior-Distribution-and-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"2. Sampling from the Posterior Distribution and Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"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.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"data_hosp = df.hosp\ndata_wastewater = df.log_ww_conc\nobstimes = df.obstimes\nparam_change_times = 1:7:length(obstimes) # Change every week\npriors_only = false\nn_samples = 200\n\nmodel_params = create_uciwweihr_model_params()\nsamples = uciwweihr_fit(\n data_hosp,\n data_wastewater;\n obstimes,\n param_change_times,\n priors_only,\n n_samples,\n params = model_params\n)\nmodel_output = uciwweihr_gq_pp(\n samples,\n data_hosp,\n data_wastewater;\n obstimes = obstimes,\n param_change_times = param_change_times,\n params = model_params\n)\n\nfirst(model_output[1][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"first(model_output[2][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"first(model_output[3][:,1:5], 5)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.-MCMC-Diagnostic-Plots/Results-Along-with-Posterior-Predictive-Distribution.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3. MCMC Diagnostic Plots/Results Along with Posterior Predictive Distribution.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"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.","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"uciwweihr_visualizer(\n pp_samples = model_output[1],\n gq_samples = model_output[2],\n data_hosp = data_hosp,\n data_wastewater = data_wastewater, \n actual_rt_vals = df.rt, \n actual_w_t = df.wt, \n actual_non_time_varying_vals = params,\n bayes_dist_type = \"Posterior\",\n save_plots = true\n)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.1.-MCMC-Diagnostic-Plots.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.1. MCMC Diagnostic Plots.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 1)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.2.-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.2. Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 2)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.3.-Non-Time-Varying-Parameter-Results-Plot.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.3. Non-Time Varying Parameter Results Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 3)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#3.4.-Posterior-Predictive-Distribution-Plot.","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"3.4. Posterior Predictive Distribution Plot.","text":"","category":"section"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","text":"(Image: Plot 4)","category":"page"},{"location":"tutorials/uciwwiehr_model_fitting_no_forecast/#[Tutorial-Contents](@ref-tutorial_home)","page":"UCIWWEIHR FITTING MODEL W/OUT FORECASTING","title":"Tutorial Contents","text":"","category":"section"},{"location":"tutorials/getting_started/#getting_started","page":"GETTING STARTED","title":"Getting Started","text":"","category":"section"},{"location":"tutorials/getting_started/","page":"GETTING STARTED","title":"GETTING STARTED","text":"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.","category":"page"},{"location":"tutorials/getting_started/#1.-Installation.","page":"GETTING STARTED","title":"1. Installation.","text":"","category":"section"},{"location":"tutorials/getting_started/","page":"GETTING STARTED","title":"GETTING STARTED","text":"To install the UCIWWEIHR.jl package, open the Julia REPL and run the following command:","category":"page"},{"location":"tutorials/getting_started/","page":"GETTING STARTED","title":"GETTING STARTED","text":"using Pkg\nPkg.add(\"git@github.com:cbernalz/UCIWWEIHR.jl.git\")","category":"page"},{"location":"tutorials/getting_started/#[Tutorial-Contents](@ref-tutorial_home)","page":"GETTING STARTED","title":"Tutorial Contents","text":"","category":"section"},{"location":"reference/#reference","page":"REFERENCE","title":"Reference","text":"","category":"section"},{"location":"reference/#Contents","page":"REFERENCE","title":"Contents","text":"","category":"section"},{"location":"reference/","page":"REFERENCE","title":"REFERENCE","text":"Pages = [\"reference.md\"]","category":"page"},{"location":"reference/#Index","page":"REFERENCE","title":"Index","text":"","category":"section"},{"location":"reference/","page":"REFERENCE","title":"REFERENCE","text":"Pages = [\"reference.md\"]","category":"page"},{"location":"reference/","page":"REFERENCE","title":"REFERENCE","text":"Modules = [UCIWWEIHR]","category":"page"},{"location":"reference/#UCIWWEIHR.uciwweihr_model_params","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_model_params","text":"uciwweihr_model_params\n\nStruct for holding parameters used in the UCIWWEIHR ODE compartmental model. Use create_uciwweihr_model_params to create an instance of this struct.\n\nFields\n\nE_init_sd::Float64=50.0: Standard deviation for the initial number of exposed individuals.\nE_init_mean::Int64=200: Mean for the initial number of exposed individuals.\nI_init_sd::Float64=20.0: Standard deviation for the initial number of infected individuals.\nI_init_mean::Int64=100: Mean for the initial number of infected individuals.\nH_init_sd::Float64=5.0: Standard deviation for the initial number of hospitalized individuals.\nH_init_mean::Int64=20: Mean for the initial number of hospitalized individuals.\ngamma_sd::Float64=0.02: Standard deviation for the rate of incubation.\nlog_gamma_mean::Float64=log(1/4): Mean for the rate of incubation on log scale.\nnu_sd::Float64=0.02: Standard deviation for the rate of leaving the infected compartment.\nlog_nu_mean::Float64=log(1/7): Mean for the rate of leaving the infected compartment on the log scale.\nepsilon_sd::Float64=0.02: Standard deviation for the rate of hospitalization recovery.\nlog_epsilon_mean::Float64=log(1/5): Mean for the rate of hospitalization recovery on the log scale.\nrho_gene_sd::Float64=0.02: Standard deviation for the rho prior.\nlog_rho_gene_mean::Float64=log(0.011): Mean for the row prior on log scale.\ntau_sd::Float64=0.02: Standard deviation for the scale/variation of the log scale data.\nlog_tau_mean::Float64=log(0.1): Mean for the scale/variation of the log scale data on log scale itself.\ndf_shape::Float64=2.0: Shape parameter for the gamma distribution.\ndf_scale::Float64=10.0: Scale parameter for the gamma distribution.\nsigma_hosp_sd::Float64=50.0: Standard deviation for the negative binomial distribution for hospital data.\nsigma_hosp_mean::Float64=500.0: Mean for the negative binomial distribution for hospital data.\nRt_init_sd::Float64=0.3: Standard deviation for the initial value of the time-varying reproduction number.\nRt_init_mean::Float64=0.2: Mean for the initial value of the time-varying reproduction number.\nsigma_Rt_sd::Float64=0.2: Standard deviation for normal prior of log time-varying reproduction number standard deviation.\nsigma_Rt_mean::Float64=-3.0: Mean for normal prior of log time-varying reproduction number standard deviation.\nw_init_sd::Float64=0.1: Standard deviation for the initial value of the time-varying hospitalization rate.\nw_init_mean::Float64=log(0.35): Mean for the initial value of the time-varying hospitalization rate.\nsigma_w_sd::Float64=0.2: Standard deviation for normal prior of log time-varying hospitalization rate standard deviation.\nsigma_w_mean::Float64=-3.5: Mean for normal prior of time-varying hospitalization rate standard deviation.\n\n\n\n\n\n","category":"type"},{"location":"reference/#UCIWWEIHR.uciwweihr_sim_params","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_sim_params","text":"uciwweihr_sim_params\n\nStruct for holding parameters used in the UCIWWEIHR ODE compartmental model simulation. Use create_uciwweihr_sim_params to create an instance of this struct.\n\nFields\n\ntime_points::Int64: Number of time points for the simulation.\nseed::Int64: Seed for random number generation.\nE_init::Int64: Initial number of exposed individuals.\nI_init::Int64: Initial number of infected individuals.\nH_init::Int64: Initial number of hospitalized individuals.\ngamma::Float64: Rate of incubation.\nnu::Float64: Rate of leaving the infected compartment.\nepsilon::Float64: Rate of hospitalization recovery.\nrho_gene::Float64: Contribution of infected individual's pathogen genome into wastewater.\ntau::Float64: Scale/variation of the log concentration of pathogen genome in wastewater.\ndf::Float64: Degrees of freedom for generalized t-distribution for log concentration of pathogen genome in wastewater.\nsigma_hosp::Float64: Standard deviation for the negative binomial distribution for hospital data.\nRt::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying reproduction number.\nsigma_Rt::Float64: Standard deviation for random walk of time-varying reproduction number.\nw::Union{Float64, Vector{Float64}}: Initial value or time series of the time-varying hospitalization rate.\nsigma_w::Float64: Standard deviation for random walk of time-varying hospitalization rate.\nrt_init::Float64: Initial value of the time-varying reproduction number, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.\nw_init::Float64: Initial value of the time-varying hospitalization rate, NOT USER SPECIFIED create_uciwweihr_params TAKES CARE OF THIS.\n\n\n\n\n\n","category":"type"},{"location":"reference/#UCIWWEIHR.ChainsCustomIndex-Tuple{MCMCChains.Chains, BitMatrix}","page":"REFERENCE","title":"UCIWWEIHR.ChainsCustomIndex","text":"ChainsCustomIndex(c::Chains, indices_to_keep::BitMatrix)\n\nReduce Chains object to only wanted indices. \n\nFunction created by Damon Bayer. \n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.NegativeBinomial2-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.NegativeBinomial2","text":"Create a re-parametrized negative binomial distribution in terms of mean and overdispersion.\n\nArguments\n\nμ: Mean of the distribution.\nϕ: Overdispersion parameter.\n\nReturns\n\nA Distributions.NegativeBinomial distribution object.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.calculate_quantiles-NTuple{4, Any}","page":"REFERENCE","title":"UCIWWEIHR.calculate_quantiles","text":"calculate_quantiles(df, chain, var_prefix, quantiles)\n\nCalculate quantiles for a given chain and variable prefix. Quantiles can be any user desired quantile.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.create_uciwweihr_model_params-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.create_uciwweihr_model_params","text":"create_uciwweihr_model_params(; kwargs...)\n\nCreates a uciwweihr_sim_params struct with the option to either use a predetermined Rt and w or generate them as random walks.\n\nArguments\n\nkwargs...: Named arguments corresponding to the fields in uciwweihr_sim_params.\n\nReturns\n\nparams::uciwweihr_sim_params: A struct with simulation parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.create_uciwweihr_sim_params-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.create_uciwweihr_sim_params","text":"createuciwweihrsim_params(; kwargs...)\n\nCreates a uciwweihr_sim_params struct with the option to either use a predetermined Rt and w or generate them as random walks.\n\nArguments\n\nkwargs...: Named arguments corresponding to the fields in uciwweihr_sim_params.\n\nReturns\n\nparams::uciwweihr_sim_params: A struct with simulation parameters.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.eihr_ode!-NTuple{4, Any}","page":"REFERENCE","title":"UCIWWEIHR.eihr_ode!","text":"eihr_ode!(du, u, p, t)\n\nCalculate the ordinary differential equations (ODEs) for the EIHR model.\n\nParameters:\n\ndu: Array{Float64,1} - The derivative of the state variables.\nu: Array{Float64,1} - The current state variables.\np: Tuple{Float64,Float64,Float64,Float64,Float64} - The model parameters (alpha, gamma, nu, w, epsilon).\nt: Float64 - The current time.\n\nReturns:\n\ndu: Array{Float64,1} - The derivative of the state variables.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_colors-Tuple{Any}","page":"REFERENCE","title":"UCIWWEIHR.generate_colors","text":"generate_ribbon_colors(number_of_colors)\n\nGenerates a vector with colors for ribbons in plots.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_logit_normal_random_walk-Tuple{Int64, Float64, Float64}","page":"REFERENCE","title":"UCIWWEIHR.generate_logit_normal_random_walk","text":"generate_logit_normal_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)\n\nGenerates a logit-normal random walk time series.\n\nArguments\n\ntime_points::Int64: Number of time points.\nsigma::Float64: Standard deviation of the random walk in logit space.\ninit_val::Float64: Initial value of the random walk on the probability scale.\n\nReturns\n\nwalk::Vector{Float64}: Generated random walk on the probability scale.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_random_walk-Tuple{Int64, Float64, Float64}","page":"REFERENCE","title":"UCIWWEIHR.generate_random_walk","text":"generate_random_walk(time_points::Int64, sigma::Float64, init_val::Float64)\n\nGenerates a random walk time series.\n\nArguments\n\ntime_points::Int64: Number of time points.\nsigma::Float64: Standard deviation of the random walk.\ninit_val::Float64: Initial value of the random walk.\n\nReturns\n\nwalk::Vector{Float64}: Generated random walk.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.generate_simulation_data_agent","page":"REFERENCE","title":"UCIWWEIHR.generate_simulation_data_agent","text":"Generating Simulation Data for Agent Based Model\n\nTo 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\n\nFunction Signature\n\nArguments\n\nseed::Int64: Seed for random number generation. Default value is 1.\npop_size::Int64: Size of the population. Default value is 1000.\nI_init::Int64: Initial number of infected individuals. Default value is 200.\nH_init::Int64: Initial number of hospitalized individuals. Default value is 20.\nbeta::Float64: Transmission rate. Default value is 0.001.\ngamma::Float64: Rate of exposed individuals becoming infectious. Default value is 1/4.\nnu::Float64: Rate of infected individuals recovering or getting hospitalized. Default value is 1/7.\nepsilon::Float64: Rate of hospitalized individuals recovering. Default value is 1/5.\nw_init::Float64: Probability of an infected individual becoming hospitalized. Default value is 0.35.\n\nReturns\n\ndf::DataFrame: A DataFrame containing the simulation data with columns Time, S, E, I, H, and R.\n\n\n\n\n\n","category":"function"},{"location":"reference/#UCIWWEIHR.generate_simulation_data_uciwweihr-Tuple{uciwweihr_sim_params}","page":"REFERENCE","title":"UCIWWEIHR.generate_simulation_data_uciwweihr","text":"generate_simulation_data(params::UCIWWEIHRParams)\n\nGenerates simulation data for the UCIWWEIHR ODE compartmental model.\n\nArguments\n\nparams::uciwweihr_sim_params: Struct containing parameters for the simulation.\n\nReturns\n\ndf::DataFrame: A DataFrame containing the simulation data with columns obstimes, log_ww_conc, hosp, rt, and wt.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.mcmcdiags_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.mcmcdiags_vis","text":"mcmcdiags_vis(...)\n\nDefault 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.\n\nArguments\n\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\ndesired_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\"]].\nactual_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.\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmcdiagnosisplots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.non_time_varying_param_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.non_time_varying_param_vis","text":"non_time_varying_param_vis(...)\n\nUsed in the uciwweihr_visualizer to create visuals for non-time varying parameters.\n\nArguments\n\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\ndesired_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\"]\nbayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is \"Posterior\".\nactual_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.\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmcnontimevaryingparameterplots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.power-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.power","text":"power(a,b)\n\nRaise `a` to the `b` power\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.predictive_param_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.predictive_param_vis","text":"predictive_param_vis(...)\n\nUsed in the uciwweihr_visualizer to create visuals for wastewater data and hospitalization data.\n\nArguments\n\npp_samples: A DataFrame of posterior or prior predictive samples.\ndata_wastewater: An array of actual wastewater values if user has access to them assumed, using time scale of observed time points. Default is nothing.\ndata_hosp: An array of actual hospitalization values if user has access to them assumed, , using time scale of observed time points. Default is nothing.\nforecast_weeks: An integer of the number of weeks forecasted. Default is 0.\nvars_to_pred: A list of variables to predict. Default is [\"datawastewater\", \"datahosp\"].\nquantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].\nbayes_dist_type: A string to indicate if user is using Posterior or Prior distribution. Default is \"Posterior\".\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmcpredparameter_plots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.repeat_last_n_elements-Union{Tuple{T}, Tuple{Vector{T}, Int64, Int64}} where T","page":"REFERENCE","title":"UCIWWEIHR.repeat_last_n_elements","text":"repeat_last_n_elements(x::Vector{T}, n::Int, w::Int) where T\n\nModifies a given array so that the last n elements are repeated w times.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.save_plots_to_docs-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.save_plots_to_docs","text":"save_plots_to_docs(plot, filename; format = \"png\")\n\nSaves plots to docs/plots directory.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.startswith_any-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.startswith_any","text":"startswith_any(name, patterns)\n\nChecks if the name of time varying paramter starts with any of the patterns.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.time_varying_param_vis-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.time_varying_param_vis","text":"time_varying_param_vis(...)\n\nUsed in the uciwweihr_visualizer to create visuals for time varying parameters.\n\nArguments\n\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\nactual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\nactual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\ntime_varying_params: A list of time varying parameters to visualize. Default is [\"rtvals\", \"wt\"].\nquantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save: A string to indicate the name of the plot to save. Default is \"mcmctimevaryingparameterplots\".\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.uciwweihr_fit-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_fit","text":"uciwweihr_fit(...)\n\nThis 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.\n\nArguments\n\ndata_hosp: An array of hospital data.\ndata_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.\nobstimes: An array of timepoints for observed hosp/wastewater.\npriors_only::Bool=false: A boolean to indicate if only priors are to be sampled.\nn_samples::Int64=500: Number of samples to be drawn.\nn_chains::Int64=1: Number of chains to be run.\nseed::Int64=2024: Seed for the random number generator.\nparams::uciwweihr_model_params: A struct containing parameters for the model.\n\nReturns\n\nSamples from the posterior or prior distribution.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.uciwweihr_model-Tuple{Any, Any}","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_model","text":"uciwweihr_model(...)\n\nThis 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.\n\nArguments\n\ndata_hosp: An array of hospital data.\ndata_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.\nobstimes: An array of timepoints for observed hosp/wastewater.\nparam_change_times: An array of timepoints where the parameters change.\nparams::uciwweihr_model_params: A struct containing parameters for the model.\n\n\n\n\n\n","category":"method"},{"location":"reference/#UCIWWEIHR.uciwweihr_visualizer-Tuple{}","page":"REFERENCE","title":"UCIWWEIHR.uciwweihr_visualizer","text":"uciwweihr_visualizer(...)\n\nDefault 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.\n\nArguments\n\npp_sampeles: Posterior predictive samples from the posterior/prior distribution, index 1 in uciwweihrgqpp output.\ngq_samples: Generated quantities samples from the posterior/prior distribution, index 2 in uciwweihrgqpp output.\ndata_hosp: An array of hospital data.\ndata_wastewater: An array of pathogen genome concentration in localized wastewater data.\nactual_rt_vals: An array of actual Rt values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\nactual_w_t: An array of actual w_t values if user has access to them assumed to be on a daily scale. This typically will come from some simulation. Default is nothing.\nactual_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.\nforecast_weeks: Number of weeks to forecasted. Default is 0.\ndesired_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\"]].\ntime_varying_params: A list of time varying parameters to visualize. Default is [\"rtvals\", \"wt\"].\nvar_to_pred: A list of variables to predict. Default is [\"datawastewater\", \"datahosp\"].\nquantiles: A list of quantiles to calculate for ploting uncertainty. Default is [0.5, 0.8, 0.95].\nbayes_dist_type: A string to indicate if user is using Posterior or Prior distribution (\"Posterior\" / \"Prior\").\nmcmcdaigs::Bool=true: A boolean to indicate if user wants to visualize mcmc diagnosis plots and Effective Sample Size(ESS).\ntime_varying_plots::Bool=true: A boolean to indicate if user wants to visualize time varying parameters. \nnon_time_varying_plots::Bool=true: A boolean to indicate if user wants to visualize non-time varying parameters.\npred_param_plots::Bool=true: A boolean to indicate if user wants to visualize posterior (or prior) predictive parameter results.\nsave_plots::Bool=false: A boolean to indicate if user wants to save the plots as pngs into a plots folder.\nplot_name_to_save_mcmcdiag: A string to indicate the name of the plot to save for MCMC diagnostics. Default is \"mcmcdiagnosisplots\".\nplot_name_to_save_time_varying: A string to indicate the name of the plot to save for time varying parameters. Default is \"mcmctimevaryingparameterplots\".\nplot_name_to_save_non_time_varying: A string to indicate the name of the plot to save for non-time varying parameters. Default is \"mcmcnontimevaryingparameterplots\".\nplot_name_to_save_pred_param: A string to indicate the name of the plot to save for posterior (or prior) predictive parameter results. Default is \"mcmcpredparameter_plots\".\n\n\n\n\n\n","category":"method"},{"location":"tutorials/uciwweihr_simulation_data/#uciwweihr_simulation_data","page":"UCIWWEIHR SIMULATION DATA","title":"Generating simulated data with UCIWWEIHR ODE compartmental based model.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"This package provides a way to also simulate data using the UCIWWEIHR ODE compartmental based model specified in the future paper. The function called generate_simulation_data_uciwweihr.jl can be used to generate synthetic data for a given number of samples and features. Here we provide a demonstration using the default settings of generate_simulation_data_uciwweihr.jl :","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.-Functionality.","page":"UCIWWEIHR SIMULATION DATA","title":"1. Functionality.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"using UCIWWEIHR\nusing Plots\n# Running simulation function with defaults\nparams = create_uciwweihr_sim_params()\ndf = generate_simulation_data_uciwweihr(params)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2-Visualizing-UCIWWEIHR-model-results.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2 Visualizing UCIWWEIHR model results.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"Here we can make simple plots to visualize the data generated using the Plots package.","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.1.-Concentration-of-pathogen-genome-in-wastewater(WW).","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.1. Concentration of pathogen genome in wastewater(WW).","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.log_ww_conc,\n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Conc. of Pathogen Genome in WW\", \n title=\"Plot of Conc. of Pathogen Genome in WW Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.2.-Hospitalizations.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.2. Hospitalizations.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.hosp, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Hosp\", \n title=\"Plot of Hosp Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.3.-Reproductive-number.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.3. Reproductive number.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.rt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Rt Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#1.2.4.-Hospitalization-rate.","page":"UCIWWEIHR SIMULATION DATA","title":"1.2.4. Hospitalization rate.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.wt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Hospitalization Rate Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.-Alternate-Functionality.","page":"UCIWWEIHR SIMULATION DATA","title":"2. Alternate Functionality.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"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.","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"using UCIWWEIHR\nusing Plots\n# Running simulation function with prespecified Rt and hospitalization probability\nrt_custom = vcat(\n range(1, stop=1.8, length=7*4),\n fill(1.8, 7*2),\n range(1.8, stop=1, length=7*8),\n range(0.98, stop=0.8, length=7*2),\n range(0.8, stop=1.1, length=7*6),\n range(1.1, stop=0.97, length=7*3)\n)\nw_custom = vcat(\n range(0.3, stop=0.38, length=7*5),\n fill(0.38, 7*2),\n range(0.38, stop=0.25, length=7*8),\n range(0.25, stop=0.28, length=7*2),\n range(0.28, stop=0.34, length=7*6),\n range(0.34, stop=0.28, length=7*2)\n)\nparams = create_uciwweihr_sim_params(\n time_points = length(rt_custom),\n Rt = rt_custom, \n w = w_custom\n)\ndf = generate_simulation_data_uciwweihr(params)\nfirst(df, 5)","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2-Visualizing-UCIWWEIHR-model-results.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2 Visualizing UCIWWEIHR model results.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"We can visualize these results using the Plots package.","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.1.-Concentration-of-pathogen-genome-in-wastewater(WW).","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.1. Concentration of pathogen genome in wastewater(WW).","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.log_ww_conc,\n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Conc. of Pathogen Genome in WW\", \n title=\"Plot of Conc. of Pathogen Genome in WW Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.2.-Hospitalizations.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.2. Hospitalizations.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.hosp, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Hosp\", \n title=\"Plot of Hosp Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.3.-Reproductive-number.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.3. Reproductive number.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.rt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Rt Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#2.2.4.-Hospitalization-rate.","page":"UCIWWEIHR SIMULATION DATA","title":"2.2.4. Hospitalization rate.","text":"","category":"section"},{"location":"tutorials/uciwweihr_simulation_data/","page":"UCIWWEIHR SIMULATION DATA","title":"UCIWWEIHR SIMULATION DATA","text":"plot(df.obstimes, df.wt, \n label=nothing,\n xlabel=\"Obstimes\", \n ylabel=\"Rt\", \n title=\"Plot of Hospitalization Rate Over Time\")","category":"page"},{"location":"tutorials/uciwweihr_simulation_data/#[Tutorial-Contents](@ref-tutorial_home)","page":"UCIWWEIHR SIMULATION DATA","title":"Tutorial Contents","text":"","category":"section"},{"location":"#UCIWWEIHR.jl","page":"HOME","title":"UCIWWEIHR.jl","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"Welcome to the UCIWWEIHR.jl package documentation! CURRENTLY UNDER DEVELOPMENT!!!","category":"page"},{"location":"","page":"HOME","title":"HOME","text":"By : Christian O. Bernal Zelaya & Volodymyr M. Minin.","category":"page"},{"location":"#Introduction","page":"HOME","title":"Introduction","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"UCIWWEIHR.jl is a Julia package for forecasting and nowcasting COVID-19 hospitalizations using pathogen genome concentrations. UCIWWEIHR.jl Package License","category":"page"},{"location":"#Features","page":"HOME","title":"Features","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"Comprehensive library of Bayesian models\nSimulation of infectious disease \nModel calibration\nSensitivity analysis and uncertainty quantification?\nVisualization of results and MCMC evaluations(live?)","category":"page"},{"location":"#Installation","page":"HOME","title":"Installation","text":"","category":"section"},{"location":"","page":"HOME","title":"HOME","text":"To install UCIWWEIHR.jl, you can use the Julia package manager. Open the Julia REPL and run the following command:","category":"page"},{"location":"","page":"HOME","title":"HOME","text":"using Pkg\nPkg.add(\"git@github.com:cbernalz/UCIWWEIHR.jl.git\")","category":"page"}] } diff --git a/dev/tutorial_index/index.html b/dev/tutorial_index/index.html index 7c5126e..0a6bdf6 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/bad363a3.svg b/dev/tutorials/agent_based_simulation_data/8e00334d.svg similarity index 87% rename from dev/tutorials/agent_based_simulation_data/bad363a3.svg rename to dev/tutorials/agent_based_simulation_data/8e00334d.svg index 9accf80..e1aa24d 100644 --- a/dev/tutorials/agent_based_simulation_data/bad363a3.svg +++ b/dev/tutorials/agent_based_simulation_data/8e00334d.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 325c3f8..1f42152 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 89b43a9..a839d35 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("git@github.com:cbernalz/UCIWWEIHR.jl.git")

Tutorial Contents

+Pkg.add("git@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 d242af5..fe350b7 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 9d640c7..43e79fa 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 d79bf01..fd606db 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 838afb3..372b038 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 2e82b18..f3ed148 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 1f97ebd..8d357fb 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_time_varying_parameter_plots.png b/dev/tutorials/plots/mcmc_time_varying_parameter_plots.png index 232ac55..c01d0c0 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 5687000..d7d32de 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_simulation_data/1b2e726f.svg b/dev/tutorials/uciwweihr_simulation_data/06933b3d.svg similarity index 86% rename from dev/tutorials/uciwweihr_simulation_data/1b2e726f.svg rename to dev/tutorials/uciwweihr_simulation_data/06933b3d.svg index 221923b..000275c 100644 --- a/dev/tutorials/uciwweihr_simulation_data/1b2e726f.svg +++ b/dev/tutorials/uciwweihr_simulation_data/06933b3d.svg @@ -1,41 +1,41 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/1ac75fbd.svg b/dev/tutorials/uciwweihr_simulation_data/26e1137d.svg similarity index 87% rename from dev/tutorials/uciwweihr_simulation_data/1ac75fbd.svg rename to dev/tutorials/uciwweihr_simulation_data/26e1137d.svg index 44b198a..b98355f 100644 --- a/dev/tutorials/uciwweihr_simulation_data/1ac75fbd.svg +++ b/dev/tutorials/uciwweihr_simulation_data/26e1137d.svg @@ -1,39 +1,39 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/05a2eda0.svg b/dev/tutorials/uciwweihr_simulation_data/2eee73a6.svg similarity index 87% rename from dev/tutorials/uciwweihr_simulation_data/05a2eda0.svg rename to dev/tutorials/uciwweihr_simulation_data/2eee73a6.svg index 6015e1c..a4d7c8d 100644 --- a/dev/tutorials/uciwweihr_simulation_data/05a2eda0.svg +++ b/dev/tutorials/uciwweihr_simulation_data/2eee73a6.svg @@ -1,41 +1,41 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/0021e6bd.svg b/dev/tutorials/uciwweihr_simulation_data/573e905b.svg similarity index 85% rename from dev/tutorials/uciwweihr_simulation_data/0021e6bd.svg rename to dev/tutorials/uciwweihr_simulation_data/573e905b.svg index d9e7154..fc74998 100644 --- a/dev/tutorials/uciwweihr_simulation_data/0021e6bd.svg +++ b/dev/tutorials/uciwweihr_simulation_data/573e905b.svg @@ -1,41 +1,41 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/160f1a40.svg b/dev/tutorials/uciwweihr_simulation_data/686101c5.svg similarity index 87% rename from dev/tutorials/uciwweihr_simulation_data/160f1a40.svg rename to dev/tutorials/uciwweihr_simulation_data/686101c5.svg index 5f48d1e..e184137 100644 --- a/dev/tutorials/uciwweihr_simulation_data/160f1a40.svg +++ b/dev/tutorials/uciwweihr_simulation_data/686101c5.svg @@ -1,41 +1,41 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/f1d396ec.svg b/dev/tutorials/uciwweihr_simulation_data/7459428b.svg similarity index 86% rename from dev/tutorials/uciwweihr_simulation_data/f1d396ec.svg rename to dev/tutorials/uciwweihr_simulation_data/7459428b.svg index beb3e41..ebe2504 100644 --- a/dev/tutorials/uciwweihr_simulation_data/f1d396ec.svg +++ b/dev/tutorials/uciwweihr_simulation_data/7459428b.svg @@ -1,39 +1,39 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/1afa9609.svg b/dev/tutorials/uciwweihr_simulation_data/9e5c4aba.svg similarity index 87% rename from dev/tutorials/uciwweihr_simulation_data/1afa9609.svg rename to dev/tutorials/uciwweihr_simulation_data/9e5c4aba.svg index 6ec4abe..9fe05b7 100644 --- a/dev/tutorials/uciwweihr_simulation_data/1afa9609.svg +++ b/dev/tutorials/uciwweihr_simulation_data/9e5c4aba.svg @@ -1,43 +1,43 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/429c2358.svg b/dev/tutorials/uciwweihr_simulation_data/e75a1bad.svg similarity index 87% rename from dev/tutorials/uciwweihr_simulation_data/429c2358.svg rename to dev/tutorials/uciwweihr_simulation_data/e75a1bad.svg index 7b4ecc4..90e1011 100644 --- a/dev/tutorials/uciwweihr_simulation_data/429c2358.svg +++ b/dev/tutorials/uciwweihr_simulation_data/e75a1bad.svg @@ -1,39 +1,39 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/uciwweihr_simulation_data/index.html b/dev/tutorials/uciwweihr_simulation_data/index.html index 9d2eeea..4838c8c 100644 --- a/dev/tutorials/uciwweihr_simulation_data/index.html +++ b/dev/tutorials/uciwweihr_simulation_data/index.html @@ -2,25 +2,25 @@ UCIWWEIHR SIMULATION DATA · UCIWWEIHR.jl

Generating simulated data with UCIWWEIHR ODE compartmental based model.

This package provides a way to also simulate data using the UCIWWEIHR ODE compartmental based model specified in the future paper. The function called generate_simulation_data_uciwweihr.jl can be used to generate synthetic data for a given number of samples and features. Here we provide a demonstration using the default settings of generate_simulation_data_uciwweihr.jl :

1. Functionality.

using UCIWWEIHR
 using Plots
 # Running simulation function with defaults
-params = create_uciwweihr_params()
+params = create_uciwweihr_sim_params()
 df = generate_simulation_data_uciwweihr(params)
 first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.493572200.997770.341455
220.569888271.014680.34689
330.803061270.9891190.343463
440.635337251.069040.351097
550.67934381.109150.366607

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(
@@ -39,7 +39,7 @@
     range(0.28, stop=0.34, length=7*6),
     range(0.34, stop=0.28, length=7*2)
 )
-params = create_uciwweihr_params(
+params = create_uciwweihr_sim_params(
     time_points = length(rt_custom),
     Rt = rt_custom,
     w = w_custom
@@ -49,16 +49,16 @@
     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 fd6fd71..87948b6 100644 --- a/dev/tutorials/uciwwiehr_model_fitting_forecast/index.html +++ b/dev/tutorials/uciwwiehr_model_fitting_forecast/index.html @@ -1,31 +1,33 @@ UCIWWEIHR FITTING MODEL W/ FORECASTING · UCIWWEIHR.jl

Generating Posterior Distribution Samples with UCIWWEIHR ODE Compartmental Based Model with Forecasting.

Here we extend the previous tutorial to include forecasting capabilities. We start with generating out data using generate_simulation_data_uciwweihr's alternate parameterization where we do not prespecify the effective reproduction number and hospitalization probability but instead preform a log-normal random walk and a logit-normal random walk respectively. We then sample from the posterior distribution using the uciwweihr_fit.jl function. We then generate desired quantities and forecast for a given time period with the posterior predictive distribution, using uciwweihr_gq_pp.jl.

1. Data Generation.

Here we generate two datasets, one with 150 time points and one with 178 time points. We will use the 150 time point dataset for fitting and the 178 time point dataset for forecast evaluation.

using UCIWWEIHR
 # Running simulation function with presets
-params = create_uciwweihr_params(
+params = create_uciwweihr_sim_params(
     time_points = 150
 )
 df = generate_simulation_data_uciwweihr(params)
 
-params_ext = create_uciwweihr_params(
+params_ext = create_uciwweihr_sim_params(
     time_points = 178
 )
 df_ext = generate_simulation_data_uciwweihr(params_ext)
-first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.493572200.997770.341455
220.569888271.014680.34689
330.803061270.9891190.343463
440.635337251.069040.351097
550.67934381.109150.366607
first(df_ext, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.323573190.997770.358155
220.451504261.014680.349014
330.586063210.9891190.351422
440.534381221.069040.358463
550.715517281.109150.352277

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, then 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 diference here is that we set forecast = true and forecast_weeks = 4 to forecast 4 weeks into the future.

data_hosp = df.hosp
+first(df, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.493572200.997770.341455
220.569888271.014680.34689
330.803061270.9891190.343463
440.635337251.069040.351097
550.67934381.109150.366607
first(df_ext, 5)
5×5 DataFrame
Rowobstimeslog_ww_conchosprtwt
Int64Float64Int64Float64Float64
110.323573190.997770.358155
220.451504261.014680.349014
330.586063210.9891190.351422
440.534381221.069040.358463
550.715517281.109150.352277

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.

data_hosp = df.hosp
 data_wastewater = df.log_ww_conc
 obstimes = df.obstimes
 param_change_times = 1:7:length(obstimes) # Change every week
 priors_only = false
-n_samples = 50
+n_samples = 200
 forecast = true
 forecast_weeks = 4
 
+model_params = create_uciwweihr_model_params()
 samples = uciwweihr_fit(
     data_hosp,
     data_wastewater;
     obstimes,
     param_change_times,
     priors_only,
-    n_samples
+    n_samples,
+    params = model_params
 )
 model_output = uciwweihr_gq_pp(
     samples,
@@ -33,11 +35,12 @@
     data_wastewater;
     obstimes = obstimes,
     param_change_times = param_change_times,
+    params = model_params,
     forecast = forecast,
     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
1111.040431.20234-0.686312
2211.040431.20234-0.686312
3311.040431.20234-0.686312
4411.040431.20234-0.686312
5511.040431.20234-0.686312
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111190.393112.14421.7208
221167.542133.98622.2228
331241.771104.08217.1341
441190.658138.44222.9441
551214.304112.79815.4107
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
1261-0.192140.6071940.344159
2271-0.6491511.69930.444562
32810.8354220.20409-0.573185
4291-0.1868421.922120.588823
53010.2860730.639916-0.91785

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.

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
1111.040431.20234-0.686312
2211.040431.20234-0.686312
3311.040431.20234-0.686312
4411.040431.20234-0.686312
5511.040431.20234-0.686312
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111199.045129.98317.1867
221177.116134.92914.8574
331188.745116.32919.6962
441139.991136.5816.7684
551140.006135.94417.0781
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
11011-0.01910181.49913-0.562664
21021-0.4576741.74647-1.02852
31031-0.2250940.816461-0.0607603
41041-1.200171.82902-0.646324
51051-1.199881.79721-0.584375

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.

uciwweihr_visualizer(
     pp_samples = model_output[1],
     gq_samples = model_output[2],
     data_hosp = df_ext.hosp,
@@ -52,19 +55,19 @@
     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: 38.0
-Effective Sample Size for I_init for Chain 1: 43.0
-Effective Sample Size for H_init for Chain 1: 85.0
-Effective Sample Size for gamma for Chain 1: 52.0
-Effective Sample Size for nu for Chain 1: 39.0
-Effective Sample Size for epsilon for Chain 1: 26.0
-Effective Sample Size for rt_init for Chain 1: 34.0
-Effective Sample Size for w_init for Chain 1: 32.0
-Effective Sample Size for rho_gene for Chain 1: 17.0
-Effective Sample Size for tau for Chain 1: 38.0
-Effective Sample Size for df for Chain 1: 85.0
-Effective Sample Size for sigma_hosp for Chain 1: 31.0
+)
Effective Sample Size for E_init for Chain 1: 150.0
+Effective Sample Size for I_init for Chain 1: 206.0
+Effective Sample Size for H_init for Chain 1: 223.0
+Effective Sample Size for gamma for Chain 1: 171.0
+Effective Sample Size for nu for Chain 1: 169.0
+Effective Sample Size for epsilon for Chain 1: 180.0
+Effective Sample Size for rt_init for Chain 1: 220.0
+Effective Sample Size for w_init for Chain 1: 170.0
+Effective Sample Size for rho_gene for Chain 1: 155.0
+Effective Sample Size for tau for Chain 1: 178.0
+Effective Sample Size for df for Chain 1: 220.0
+Effective Sample Size for sigma_hosp for Chain 1: 159.0
 Plot saved to plots/mcmc_diagnosis_plots1.png
 Plot saved to plots/mcmc_time_varying_parameter_plots1.png
 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 f136025..d0267ea 100644 --- a/dev/tutorials/uciwwiehr_model_fitting_no_forecast/index.html +++ b/dev/tutorials/uciwwiehr_model_fitting_no_forecast/index.html @@ -17,26 +17,28 @@ range(0.28, stop=0.34, length=7*6), range(0.34, stop=0.28, length=7*2) ) -params = create_uciwweihr_params( +params = create_uciwweihr_sim_params( time_points = length(rt_custom), Rt = rt_custom, 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, then 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.

data_hosp = df.hosp
+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.

data_hosp = df.hosp
 data_wastewater = df.log_ww_conc
 obstimes = df.obstimes
 param_change_times = 1:7:length(obstimes) # Change every week
 priors_only = false
-n_samples = 50
+n_samples = 200
 
+model_params = create_uciwweihr_model_params()
 samples = uciwweihr_fit(
     data_hosp,
     data_wastewater;
     obstimes,
     param_change_times,
     priors_only,
-    n_samples
+    n_samples,
+    params = model_params
 )
 model_output = uciwweihr_gq_pp(
     samples,
@@ -44,9 +46,10 @@
     data_wastewater;
     obstimes = obstimes,
     param_change_times = param_change_times,
+    params = model_params
 )
 
-first(model_output[1][:,1:5], 5)
5×5 DataFrame
Rowiterationchaindata_wastewater[1]data_hosp[1]data_wastewater[2]
Int64Int64Float64Float64Float64
1110.19653118.00.585924
2210.4747918.00.257651
3310.087104618.00.430068
4410.19221823.00.460868
5510.33760730.00.760354
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111222.68681.944515.1571
221221.27982.180814.5166
331175.88475.692614.8741
441186.6479.355619.7861
551212.54113.34117.454
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
12610.453714-0.902777-0.968575
22710.425584-0.890962-1.09667
3281-0.48232-1.21537-1.02517
4291-0.267207-1.03222-0.0427832
53010.2508030.667046-0.509208

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.

uciwweihr_visualizer(
+first(model_output[1][:,1:5], 5)
5×5 DataFrame
Rowiterationchaindata_wastewater[1]data_hosp[1]data_wastewater[2]
Int64Int64Float64Float64Float64
1110.078108725.00.369319
2210.36777117.00.456394
3310.0967619.00.422507
4410.43558315.00.25292
5510.17463325.00.45186
first(model_output[2][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_initI_initH_init
Int64Int64Float64Float64Float64
111223.70578.386219.1469
221227.97678.269716.3695
331225.03368.856118.7899
441204.83891.188221.1889
551210.72890.693918.7486
first(model_output[3][:,1:5], 5)
5×5 DataFrame
RowiterationchainE_init_non_centeredI_init_non_centeredH_init_non_centered
Int64Int64Float64Float64Float64
110110.474098-1.08069-0.170628
210210.559525-1.08651-0.726107
310310.500668-1.55719-0.242021
410410.0967546-0.4405880.237784
510510.21455-0.465304-0.250277

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.

uciwweihr_visualizer(
     pp_samples = model_output[1],
     gq_samples = model_output[2],
     data_hosp = data_hosp,
@@ -56,19 +59,19 @@
     actual_non_time_varying_vals = params,
     bayes_dist_type = "Posterior",
     save_plots = true
-)
Effective Sample Size for E_init for Chain 1: 28.0
-Effective Sample Size for I_init for Chain 1: 19.0
-Effective Sample Size for H_init for Chain 1: 29.0
-Effective Sample Size for gamma for Chain 1: 9.0
-Effective Sample Size for nu for Chain 1: 2.0
-Effective Sample Size for epsilon for Chain 1: 4.0
-Effective Sample Size for rt_init for Chain 1: 18.0
-Effective Sample Size for w_init for Chain 1: 12.0
-Effective Sample Size for rho_gene for Chain 1: 12.0
-Effective Sample Size for tau for Chain 1: 3.0
-Effective Sample Size for df for Chain 1: 8.0
-Effective Sample Size for sigma_hosp for Chain 1: 7.0
+)
Effective Sample Size for E_init for Chain 1: 41.0
+Effective Sample Size for I_init for Chain 1: 65.0
+Effective Sample Size for H_init for Chain 1: 83.0
+Effective Sample Size for gamma for Chain 1: 34.0
+Effective Sample Size for nu for Chain 1: 45.0
+Effective Sample Size for epsilon for Chain 1: 28.0
+Effective Sample Size for rt_init for Chain 1: 48.0
+Effective Sample Size for w_init for Chain 1: 20.0
+Effective Sample Size for rho_gene for Chain 1: 27.0
+Effective Sample Size for tau for Chain 1: 25.0
+Effective Sample Size for df for Chain 1: 147.0
+Effective Sample Size for sigma_hosp for Chain 1: 32.0
 Plot saved to plots/mcmc_diagnosis_plots.png
 Plot saved to plots/mcmc_time_varying_parameter_plots.png
 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