Title: | Estimate Epidemiological Delay Distributions With brms |
---|---|
Description: | Understanding and accurately estimating epidemiological delay distributions is important for public health policy. These estimates directly influence epidemic situational awareness, control strategies, and resource allocation. In this package, we provide methods to address the key challenges in estimating these distributions, including truncation, interval censoring, and dynamical biases. Despite their importance, these issues are frequently overlooked, often resulting in biased conclusions. |
Authors: | Adam Howes [aut, cre] , Sang Woo Park [aut] , Sam Abbott [aut] |
Maintainer: | Adam Howes <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2025-01-21 13:33:26 UTC |
Source: | https://github.com/epinowcast/epidist |
Add natural scale mean and standard deviation parameters
add_mean_sd(data, ...)
add_mean_sd(data, ...)
data |
A dataframe of distributional parameters |
... |
Additional arguments for method. |
Other postprocess:
add_mean_sd.default()
,
add_mean_sd.gamma_samples()
,
add_mean_sd.lognormal_samples()
,
predict_delay_parameters()
Default method for add natural scale parameters
## Default S3 method: add_mean_sd(data, ...)
## Default S3 method: add_mean_sd(data, ...)
data |
A dataframe of distributional parameters |
... |
Additional arguments for method. |
Other postprocess:
add_mean_sd()
,
add_mean_sd.gamma_samples()
,
add_mean_sd.lognormal_samples()
,
predict_delay_parameters()
Again, mu
and shape
here are the distributional parameters of brms
.
## S3 method for class 'gamma_samples' add_mean_sd(data, ...)
## S3 method for class 'gamma_samples' add_mean_sd(data, ...)
data |
A dataframe of distributional parameters |
... |
Additional arguments for method. |
Other postprocess:
add_mean_sd()
,
add_mean_sd.default()
,
add_mean_sd.lognormal_samples()
,
predict_delay_parameters()
Note that the input parameters here are mu
and sigma
, corresponding to
the distributional parameters used by brms
for the lognormal
family.
## S3 method for class 'lognormal_samples' add_mean_sd(data, ...)
## S3 method for class 'lognormal_samples' add_mean_sd(data, ...)
data |
A dataframe of distributional parameters |
... |
Additional arguments for method. |
Other postprocess:
add_mean_sd()
,
add_mean_sd.default()
,
add_mean_sd.gamma_samples()
,
predict_delay_parameters()
epidist_latent_model
objectConvert an object to an epidist_latent_model
object
as_epidist_latent_model(data)
as_epidist_latent_model(data)
data |
An object to be converted to the class |
Other latent_model:
as_epidist_latent_model.epidist_linelist_data()
,
epidist_family_model.epidist_latent_model()
,
epidist_formula_model.epidist_latent_model()
,
epidist_gen_log_lik_latent()
,
is_epidist_latent_model()
,
new_epidist_latent_model()
epidist_linelist_data
objectsThe latent model method for epidist_linelist_data
objects
## S3 method for class 'epidist_linelist_data' as_epidist_latent_model(data)
## S3 method for class 'epidist_linelist_data' as_epidist_latent_model(data)
data |
An |
Other latent_model:
as_epidist_latent_model()
,
epidist_family_model.epidist_latent_model()
,
epidist_formula_model.epidist_latent_model()
,
epidist_gen_log_lik_latent()
,
is_epidist_latent_model()
,
new_epidist_latent_model()
Create an epidist_linelist_data object
as_epidist_linelist_data(data, ...)
as_epidist_linelist_data(data, ...)
data |
The data to convert |
... |
Additional arguments passed to methods |
Other linelist_data:
as_epidist_linelist_data.data.frame()
,
as_epidist_linelist_data.default()
,
assert_epidist.epidist_linelist_data()
,
is_epidist_linelist_data()
,
new_epidist_linelist_data()
Create an epidist_linelist_data object from a data frame with event dates
## S3 method for class 'data.frame' as_epidist_linelist_data( data, pdate_lwr = NULL, sdate_lwr = NULL, pdate_upr = NULL, sdate_upr = NULL, obs_date = NULL, ... )
## S3 method for class 'data.frame' as_epidist_linelist_data( data, pdate_lwr = NULL, sdate_lwr = NULL, pdate_upr = NULL, sdate_upr = NULL, obs_date = NULL, ... )
data |
A data.frame containing line list data |
pdate_lwr |
A string giving the column of |
sdate_lwr |
A string giving the column of |
pdate_upr |
A string giving the column of |
sdate_upr |
A string giving the column of |
obs_date |
A string giving the column of |
... |
Additional arguments passed to methods |
Other linelist_data:
as_epidist_linelist_data()
,
as_epidist_linelist_data.default()
,
assert_epidist.epidist_linelist_data()
,
is_epidist_linelist_data()
,
new_epidist_linelist_data()
Create an epidist_linelist_data object from vectors of event times
## Default S3 method: as_epidist_linelist_data( data, ptime_upr = NULL, stime_lwr = NULL, stime_upr = NULL, obs_time = NULL, ... )
## Default S3 method: as_epidist_linelist_data( data, ptime_upr = NULL, stime_lwr = NULL, stime_upr = NULL, obs_time = NULL, ... )
data |
Numeric vector giving lower bounds for primary times |
ptime_upr |
Numeric vector giving upper bounds for primary times |
stime_lwr , stime_upr
|
Numeric vectors giving lower and upper bounds for secondary times |
obs_time |
Numeric vector giving observation times |
... |
Additional columns to add to the epidist_linelist_data object |
Other linelist_data:
as_epidist_linelist_data()
,
as_epidist_linelist_data.data.frame()
,
assert_epidist.epidist_linelist_data()
,
is_epidist_linelist_data()
,
new_epidist_linelist_data()
brms
Prepare naive model to pass through to brms
as_epidist_naive_model(data)
as_epidist_naive_model(data)
data |
An object to be converted to the class |
Other naive_model:
as_epidist_naive_model.epidist_linelist_data()
,
is_epidist_naive_model()
,
new_epidist_naive_model()
epidist_linelist_data
objectsThe naive model method for epidist_linelist_data
objects
## S3 method for class 'epidist_linelist_data' as_epidist_naive_model(data)
## S3 method for class 'epidist_linelist_data' as_epidist_naive_model(data)
data |
An |
Other naive_model:
as_epidist_naive_model()
,
is_epidist_naive_model()
,
new_epidist_naive_model()
Validation for epidist objects
assert_epidist(data, ...)
assert_epidist(data, ...)
data |
Object to validate |
... |
Additional arguments |
NULL invisibly
epidist_linelist_data
objectsAssert validity of epidist_linelist_data
objects
## S3 method for class 'epidist_linelist_data' assert_epidist(data, ...)
## S3 method for class 'epidist_linelist_data' assert_epidist(data, ...)
data |
An object to check |
... |
Additional arguments |
Other linelist_data:
as_epidist_linelist_data()
,
as_epidist_linelist_data.data.frame()
,
as_epidist_linelist_data.default()
,
is_epidist_linelist_data()
,
new_epidist_linelist_data()
brms
interfaceFit epidemiological delay distributions using a brms
interface
epidist(data, formula, family, prior, fn, ...)
epidist(data, formula, family, prior, fn, ...)
data |
An object with class corresponding to an implemented model. |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
prior |
One or more |
fn |
The internal function to be called. By default this is
|
... |
Additional arguments passed to |
Other fit:
epidist.default()
epidist_fit
modelsThis function computes diagnostics to assess the quality of a fitted model.
When the fitting algorithm used is "sampling"
(HMC) then the output of
epidist_diagnostics
is a data.frame
containing:
time
: the total time taken to fit all chains
samples
: the total number of samples across all chains
max_rhat
: the highest value of the Gelman-Rubin statistic
divergent_transitions
: the total number of divergent transitions
per_divergent_transitions
: the proportion of samples which had divergent
transitions
max_treedepth
: the highest value of the treedepth HMC parameter
no_at_max_treedepth
: the number of samples which attained the
max_treedepth
per_at_max_treedepth
: the proportion of samples which attained the
max_treedepth
epidist_diagnostics(fit)
epidist_diagnostics(fit)
fit |
A fitted model of class |
When the fitting algorithm is not "sampling"
(see brms::brm()
for other
possible algorithms) then diagnostics are yet to be implemented.
epidist
familyThis function is used within epidist()
to create a model specific custom
brms
family object. This custom family is passed to brms
. It is unlikely
that as a user you will need this function, but we export it nonetheless to
be transparent about what happens inside of a call to epidist()
.
epidist_family(data, family = lognormal(), ...)
epidist_family(data, family = lognormal(), ...)
data |
An object with class corresponding to an implemented model. |
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
... |
Additional arguments passed to |
Other family:
epidist_family_model()
,
epidist_family_model.default()
,
epidist_family_reparam()
,
epidist_family_reparam.default()
,
epidist_family_reparam.gamma()
epidist_family()
callThe model-specific parts of an epidist_family()
call
The model-specific parts of an epidist_formula()
call
epidist_family_model(data, family, ...) epidist_formula_model(data, formula, ...)
epidist_family_model(data, family, ...) epidist_formula_model(data, formula, ...)
data |
An object with class corresponding to an implemented model. |
family |
Output of a call to |
... |
Additional arguments passed to |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
Other family:
epidist_family()
,
epidist_family_model.default()
,
epidist_family_reparam()
,
epidist_family_reparam.default()
,
epidist_family_reparam.gamma()
Other formula:
epidist_formula()
,
epidist_formula_model.default()
Default method for defining a model specific family
## Default S3 method: epidist_family_model(data, family, ...)
## Default S3 method: epidist_family_model(data, family, ...)
data |
An object with class corresponding to an implemented model. |
family |
Output of a call to |
... |
Additional arguments passed to |
Other family:
epidist_family()
,
epidist_family_model()
,
epidist_family_reparam()
,
epidist_family_reparam.default()
,
epidist_family_reparam.gamma()
epidist
custom familyCreate the model-specific component of an epidist
custom family
## S3 method for class 'epidist_latent_model' epidist_family_model(data, family, ...)
## S3 method for class 'epidist_latent_model' epidist_family_model(data, family, ...)
data |
An object with class corresponding to an implemented model. |
family |
Output of a call to |
... |
Additional arguments passed to method. |
Other latent_model:
as_epidist_latent_model()
,
as_epidist_latent_model.epidist_linelist_data()
,
epidist_formula_model.epidist_latent_model()
,
epidist_gen_log_lik_latent()
,
is_epidist_latent_model()
,
new_epidist_latent_model()
This function contains brms
prior distributions which are specific to
particular likelihood families e.g. brms::lognormal()
.
epidist_family_prior(family, ...)
epidist_family_prior(family, ...)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
... |
Additional arguments passed to |
Other prior:
epidist_family_prior.default()
,
epidist_family_prior.lognormal()
,
epidist_model_prior()
,
epidist_model_prior.default()
,
epidist_prior()
By default, we do not return any family specific prior distributions.
## Default S3 method: epidist_family_prior(family, formula, ...)
## Default S3 method: epidist_family_prior(family, formula, ...)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
... |
Additional arguments passed to |
Other prior:
epidist_family_prior()
,
epidist_family_prior.lognormal()
,
epidist_model_prior()
,
epidist_model_prior.default()
,
epidist_prior()
We suggest priors to overwrite the brms
defaults for the lognormal family.
## S3 method for class 'lognormal' epidist_family_prior(family, formula, ...)
## S3 method for class 'lognormal' epidist_family_prior(family, formula, ...)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
... |
Additional arguments passed to |
Other prior:
epidist_family_prior()
,
epidist_family_prior.default()
,
epidist_model_prior()
,
epidist_model_prior.default()
,
epidist_prior()
epidist
family to align brms
and StanReparameterise an epidist
family to align brms
and Stan
epidist_family_reparam(family, ...)
epidist_family_reparam(family, ...)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
... |
Additional arguments passed to |
Other family:
epidist_family()
,
epidist_family_model()
,
epidist_family_model.default()
,
epidist_family_reparam.default()
,
epidist_family_reparam.gamma()
Default method for families which do not require a reparameterisation
## Default S3 method: epidist_family_reparam(family, ...)
## Default S3 method: epidist_family_reparam(family, ...)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
... |
Additional arguments passed to |
Other family:
epidist_family()
,
epidist_family_model()
,
epidist_family_model.default()
,
epidist_family_reparam()
,
epidist_family_reparam.gamma()
Reparameterisation for the gamma family
## S3 method for class 'gamma' epidist_family_reparam(family, ...)
## S3 method for class 'gamma' epidist_family_reparam(family, ...)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
... |
Additional arguments passed to |
Other family:
epidist_family()
,
epidist_family_model()
,
epidist_family_model.default()
,
epidist_family_reparam()
,
epidist_family_reparam.default()
This function is used within epidist()
to create the formula object passed
to brms
. It is unlikely that as a user you will need this function, but we
export it nonetheless to be transparent about what exactly is happening
inside of a call to epidist()
.
epidist_formula(data, family, formula, ...)
epidist_formula(data, family, formula, ...)
data |
An object with class corresponding to an implemented model. |
family |
A description of the response distribution and link function to
be used in the model created using |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
... |
Additional arguments passed to |
Other formula:
epidist_family_model()
,
epidist_formula_model.default()
Default method for defining a model specific formula
## Default S3 method: epidist_formula_model(data, formula, ...)
## Default S3 method: epidist_formula_model(data, formula, ...)
data |
An object with class corresponding to an implemented model. |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
... |
Additional arguments passed to |
Other formula:
epidist_family_model()
,
epidist_formula()
epidist
custom formulaDefine the model-specific component of an epidist
custom formula
## S3 method for class 'epidist_latent_model' epidist_formula_model(data, formula, ...)
## S3 method for class 'epidist_latent_model' epidist_formula_model(data, formula, ...)
data |
An object with class corresponding to an implemented model. |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
... |
Additional arguments passed to method. |
Other latent_model:
as_epidist_latent_model()
,
as_epidist_latent_model.epidist_linelist_data()
,
epidist_family_model.epidist_latent_model()
,
epidist_gen_log_lik_latent()
,
is_epidist_latent_model()
,
new_epidist_latent_model()
This function creates a log likelihood function that accounts for the latent variables in the model, including primary and secondary event windows and their overlap. The returned function calculates the log likelihood for a single observation by augmenting the data with the latent variables and using the underlying brms log likelihood function.
epidist_gen_log_lik_latent(family)
epidist_gen_log_lik_latent(family)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
A function that calculates the log likelihood for a single observation. The prep object must have the following variables:
vreal1
: relative observation time
vreal2
: primary event window
vreal3
: secondary event window
brms::log_lik()
for details on the brms log likelihood interface.
Other latent_model:
as_epidist_latent_model()
,
as_epidist_latent_model.epidist_linelist_data()
,
epidist_family_model.epidist_latent_model()
,
epidist_formula_model.epidist_latent_model()
,
is_epidist_latent_model()
,
new_epidist_latent_model()
This function creates a function that calculates the expected value of the
posterior predictive distribution for a latent model. The returned function
takes a prep
argument (from brms) and returns posterior expected values.
This is used internally by brms::posterior_epred()
to calculate expected
values for latent models.
epidist_gen_posterior_epred(family)
epidist_gen_posterior_epred(family)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
A function that takes a prep argument from brms and returns a matrix of posterior expected values, with one row per posterior draw and one column per observation.
brms::posterior_epred()
for details on how this is used within
brms
.
Other gen:
epidist_gen_posterior_predict()
This function creates a function that draws from the posterior predictive
distribution for a latent model using primarycensored::rpcens()
to handle
censoring and truncation. The returned function takes a prep
argument from
brms
and returns posterior predictions. This is used internally by
brms::posterior_predict()
to generate predictions for latent models.
epidist_gen_posterior_predict(family)
epidist_gen_posterior_predict(family)
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
A function that takes a prep
argument from brms and returns a
matrix of posterior predictions, with one row per posterior draw and one
column per observation. The prep
object must have the following variables:
vreal1
: relative observation time
vreal2
: primary event window
vreal3
: secondary event window
brms::posterior_predict()
for details on how this is used within
brms
, primarycensored::rpcens()
for details on the censoring approach
Other gen:
epidist_gen_posterior_epred()
This function contains brms
prior distributions which are specific to
particular epidist
models e.g. the latent_lognormal
model.
epidist_model_prior(data, ...)
epidist_model_prior(data, ...)
data |
An object with class corresponding to an implemented model. |
... |
Additional arguments passed to |
Other prior:
epidist_family_prior()
,
epidist_family_prior.default()
,
epidist_family_prior.lognormal()
,
epidist_model_prior.default()
,
epidist_prior()
By default, we do not return any model specific prior distributions.
## Default S3 method: epidist_model_prior(data, formula, ...)
## Default S3 method: epidist_model_prior(data, formula, ...)
data |
An object with class corresponding to an implemented model. |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
... |
Additional arguments passed to |
Other prior:
epidist_family_prior()
,
epidist_family_prior.default()
,
epidist_family_prior.lognormal()
,
epidist_model_prior()
,
epidist_prior()
brms
defaults, model specific priors,
family specific priors, and user provided priorsThis function obtains the brms
default prior distributions for a particular
model, then replaces these prior distributions using:
Model specific prior distributions from epidist_model_prior()
Family specific prior distributions from epidist_family_prior()
User provided prior distributions Each element of this list overwrites previous elements, such that user provided prior distribution have the highest priority. At the third stage, if a prior distribution is provided which is not included in the model, then a warning will be shown. To prevent this warning, do not pass prior distributions for parameters which are not in the model.
epidist_prior(data, family, formula, prior)
epidist_prior(data, family, formula, prior)
data |
An object with class corresponding to an implemented model. |
family |
A description of the response distribution and link function to
be used in the model created using |
formula |
A symbolic description of the model to be fitted created using
|
prior |
One or more |
Other prior:
epidist_family_prior()
,
epidist_family_prior.default()
,
epidist_family_prior.lognormal()
,
epidist_model_prior()
,
epidist_model_prior.default()
This function is used within epidist()
to create any custom Stan code which
is injected into brms
via the stanvars
argument. It is unlikely that
as a user you will need this function, but we export it nonetheless to be
transparent about what exactly is happening inside of a call to epidist()
.
epidist_stancode(data, ...)
epidist_stancode(data, ...)
data |
An object with class corresponding to an implemented model. |
... |
Additional arguments passed to |
Other stan:
epidist_stancode.default()
Default method for defining model specific Stan code
## Default S3 method: epidist_stancode(data, ...)
## Default S3 method: epidist_stancode(data, ...)
data |
An object with class corresponding to an implemented model. |
... |
Additional arguments passed to |
Other stan:
epidist_stancode()
brms
Default method used for interface using brms
## Default S3 method: epidist( data, formula = mu ~ 1, family = lognormal(), prior = NULL, fn = brms::brm, ... )
## Default S3 method: epidist( data, formula = mu ~ 1, family = lognormal(), prior = NULL, fn = brms::brm, ... )
data |
An object with class corresponding to an implemented model. |
formula |
An object of class stats::formula or brms::brmsformula
(or one that can be coerced to those classes). A symbolic description of the
model to be fitted. A formula must be provided for the distributional
parameter |
family |
A description of the response distribution and link function to
be used in the model. Every family function has a link argument allowing
users to specify the link function to be applied on the response variable.
If not specified, default links are used. For details of all supported
families see |
prior |
One or more |
fn |
The internal function to be called. By default this is
|
... |
Additional arguments passed to |
Other fit:
epidist()
epidist_latent_model
classCheck if data has the epidist_latent_model
class
is_epidist_latent_model(data)
is_epidist_latent_model(data)
data |
An object |
Other latent_model:
as_epidist_latent_model()
,
as_epidist_latent_model.epidist_linelist_data()
,
epidist_family_model.epidist_latent_model()
,
epidist_formula_model.epidist_latent_model()
,
epidist_gen_log_lik_latent()
,
new_epidist_latent_model()
epidist_linelist_data
classCheck if data has the epidist_linelist_data
class
is_epidist_linelist_data(data, ...)
is_epidist_linelist_data(data, ...)
data |
The data to convert |
... |
Additional arguments |
Other linelist_data:
as_epidist_linelist_data()
,
as_epidist_linelist_data.data.frame()
,
as_epidist_linelist_data.default()
,
assert_epidist.epidist_linelist_data()
,
new_epidist_linelist_data()
epidist_naive_model
classCheck if data has the epidist_naive_model
class
is_epidist_naive_model(data)
is_epidist_naive_model(data)
data |
An object |
Other naive_model:
as_epidist_naive_model()
,
as_epidist_naive_model.epidist_linelist_data()
,
new_epidist_naive_model()
epidist_latent_model
objectsClass constructor for epidist_latent_model
objects
new_epidist_latent_model(data)
new_epidist_latent_model(data)
data |
An object to be set with the class |
An object of class epidist_latent_model
Other latent_model:
as_epidist_latent_model()
,
as_epidist_latent_model.epidist_linelist_data()
,
epidist_family_model.epidist_latent_model()
,
epidist_formula_model.epidist_latent_model()
,
epidist_gen_log_lik_latent()
,
is_epidist_latent_model()
epidist_linelist_data
objectsClass constructor for epidist_linelist_data
objects
new_epidist_linelist_data(data)
new_epidist_linelist_data(data)
data |
A data.frame to convert |
An object of class epidist_linelist_data
Other linelist_data:
as_epidist_linelist_data()
,
as_epidist_linelist_data.data.frame()
,
as_epidist_linelist_data.default()
,
assert_epidist.epidist_linelist_data()
,
is_epidist_linelist_data()
epidist_naive_model
objectsClass constructor for epidist_naive_model
objects
new_epidist_naive_model(data)
new_epidist_naive_model(data)
data |
An object to be set with the class |
An object of class epidist_naive_model
Other naive_model:
as_epidist_naive_model()
,
as_epidist_naive_model.epidist_linelist_data()
,
is_epidist_naive_model()
Extract samples of the delay distribution parameters
predict_delay_parameters(fit, newdata = NULL, ...) predict_dpar(fit, newdata = NULL, ...)
predict_delay_parameters(fit, newdata = NULL, ...) predict_dpar(fit, newdata = NULL, ...)
fit |
A model fit with |
newdata |
An optional data.frame for which to evaluate predictions. If
|
... |
Additional arguments passed to |
Other postprocess:
add_mean_sd()
,
add_mean_sd.default()
,
add_mean_sd.gamma_samples()
,
add_mean_sd.lognormal_samples()
Linelist data for the Ebola virus collected in Sierra Leone. If you use this data in your work, please cite the corresponding paper.
sierra_leone_ebola_data
sierra_leone_ebola_data
A tibble
with 8,358 rows and 8 columns:
Unique identification number for the case
Name as character, omitted
Age as numeric
Sex as character, either "F", "M" or NA
The date symptoms began
The date the sample was tested
The district (ADM2)
The chiefdom (ADM3)
https://www.pnas.org/doi/full/10.1073/pnas.1518587113
This function simulates cases from an exponential distribution. The user may
specify the rate parameter r
, the sample size, and the upper bound of the
survival time. If the rate parameter is 0, then this function defaults to the
uniform distribution.
simulate_exponential_cases(r = 0.2, sample_size = 10000, seed, t = 30)
simulate_exponential_cases(r = 0.2, sample_size = 10000, seed, t = 30)
r |
The exponential growth rate parameter. Defaults to 0.2. |
sample_size |
The number of cases to simulate. Defaults to 10000. |
seed |
The random seed to be used in the simulation process. |
t |
Upper bound of the survival time. Defaults to 30. |
A data.frame
with two columns: case
(case number) and ptime
(primary event time).
Other simulate:
simulate_gillespie()
,
simulate_secondary()
,
simulate_uniform_cases()
This function simulates cases from an stochastic SIR model. The user may
specify the initial epidemic growth rate , the rate of recovery gamma
, the initial number of infected cases
, and the total
population size
.
simulate_gillespie(r = 0.2, gamma = 1/7, I0 = 50, N = 10000, seed)
simulate_gillespie(r = 0.2, gamma = 1/7, I0 = 50, N = 10000, seed)
r |
The initial epidemic growth rate. Defaults to 0.2. |
gamma |
The rate of recovery. Defaults to 1/7. |
I0 |
The initial number of infected people. Defaults to 50. |
N |
The total population size. Defaults to 10000. |
seed |
The random seed to be used in the simulation process. |
A data.frame
with two columns: case
(case number) and ptime
(primary event time).
Other simulate:
simulate_exponential_cases()
,
simulate_secondary()
,
simulate_uniform_cases()
This function simulates secondary events based on a given delay
distribution. The input dataset should have the primary event times in a
column named ptime
.
simulate_secondary(data, dist = rlnorm, ...)
simulate_secondary(data, dist = rlnorm, ...)
data |
A data frame with the primary event times. |
dist |
The delay distribution to be used. Defaults to |
... |
Arguments to be passed to the delay distribution function. |
A data.frame
that augments data
with two new columns: delay
(secondary event latency) and stime
(the time of the secondary event).
Other simulate:
simulate_exponential_cases()
,
simulate_gillespie()
,
simulate_uniform_cases()
This function simulates cases from a uniform distribution, where the primary
event times are uniformly distributed between 0 and t
.
simulate_uniform_cases(sample_size = 1000, t = 60)
simulate_uniform_cases(sample_size = 1000, t = 60)
sample_size |
The number of cases to simulate. |
t |
Upper bound of the uniform distribution to generate primary event times. |
A data.frame
with two columns: case
(case number) and ptime
(primary event time).
Other simulate:
simulate_exponential_cases()
,
simulate_gillespie()
,
simulate_secondary()