Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homogenizing argument names #5

Merged
merged 1 commit into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions R/ModelSEIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#'
#' @param name String. Name of the virus.
#' @param prevalence Double. Initial proportion of individuals with the virus.
#' @param infectiousness Numeric scalar between 0 and 1. Virus's rate of
#' @param transmission_rate Numeric scalar between 0 and 1. Virus's rate of
#' infection.
#' @param incubation_days Numeric scalar greater than 0. Average number of
#' incubation days.
#' @param recovery Numeric scalar between 0 and 1. Rate of recovery from virus.
#' @param recovery_rate Numeric scalar between 0 and 1. Rate of recovery_rate from virus.
#' @param x Object of class SEIR.
#' @param ... Currently ignore.
#' @export
Expand All @@ -16,7 +16,7 @@
#' - The `ModelSEIR`function returns a model of class [epiworld_model].
#' @examples
#' model_seir <- ModelSEIR(name = "COVID-19", prevalence = 0.01,
#' infectiousness = 0.9, recovery = 0.1, incubation_days = 4)
#' transmission_rate = 0.9, recovery_rate = 0.1, incubation_days = 4)
#'
#' # Adding a small world population
#' agents_smallworld(
Expand All @@ -34,11 +34,11 @@
#' plot(model_seir, main = "SEIR Model")
#' @seealso epiworld-methods
ModelSEIR <- function(
name, prevalence, infectiousness, incubation_days, recovery
name, prevalence, transmission_rate, incubation_days, recovery_rate
) {

structure(
ModelSEIR_cpp(name, prevalence, infectiousness, incubation_days, recovery),
ModelSEIR_cpp(name, prevalence, transmission_rate, incubation_days, recovery_rate),
class = c("epiworld_seir", "epiworld_model")
)

Expand Down
14 changes: 7 additions & 7 deletions R/ModelSEIRCONN.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#' @param n Integer greater than zero. Population size.
#' @param prevalence Initial proportion of individuals with the virus.
#' @param contact_rate Numeric scalar. Average number of contacts per step.
#' @param prob_transmission Numeric scalar between 0 and 1. Probability of
#' @param transmission_rate Numeric scalar between 0 and 1. Probability of
#' transmission.
#' @param incubation_days Numeric scalar greater than 0. Average number of
#' incubation days.
#' @param prob_recovery Numeric scalar between 0 and 1. Probability of recovery.
#' @param recovery_rate Numeric scalar between 0 and 1. Probability of recovery_rate.
#' @param x Object of class SEIRCONN.
#' @param ... Currently ignore.
#' @param n Number of individuals in the population.
Expand All @@ -28,8 +28,8 @@
#' n = 10000,
#' contact_rate = 2,
#' incubation_days = 7,
#' prob_transmission = 0.5,
#' prob_recovery = 0.3
#' transmission_rate = 0.5,
#' recovery_rate = 0.3
#' )
#'
#' # Running and printing
Expand All @@ -49,13 +49,13 @@
#' plot(model_seirconn)
#' @seealso epiworld-methods
ModelSEIRCONN <- function(
name, n, prevalence, contact_rate, prob_transmission,
incubation_days, prob_recovery
name, n, prevalence, contact_rate, transmission_rate,
incubation_days, recovery_rate
) {

structure(
ModelSEIRCONN_cpp(name, n, prevalence, contact_rate,
prob_transmission, incubation_days, prob_recovery),
transmission_rate, incubation_days, recovery_rate),
class = c("epiworld_seirconn", "epiworld_model")
)

Expand Down
12 changes: 6 additions & 6 deletions R/ModelSIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
#' @param name String. Name of the virus

#' @param prevalence Double. Initial proportion of individuals with the virus.
#' @param infectiousness Numeric scalar between 0 and 1. Virus's rate of
#' @param transmission_rate Numeric scalar between 0 and 1. Virus's rate of
#' infection.
#' @param recovery Numeric scalar between 0 and 1. Rate of recovery from virus.
#' @param recovery_rate Numeric scalar between 0 and 1. Rate of recovery_rate from virus.
#' @param x Object of class SIR.
#' @param ... Currently ignore.
#' @param ... Additional arguments passed to [graphics::plot].
#' @export
#' @family Models
#' @aliases epiworld_sir
#' @returns
#' - The `ModelSIR` function returns a model of class [epiworld_model].
#' @examples
#' model_sir <- ModelSIR(name = "COVID-19", prevalence = 0.01,
#' infectiousness = 0.9, recovery = 0.1)
#' transmission_rate = 0.9, recovery_rate = 0.1)
#'
#' # Adding a small world population
#' agents_smallworld(
Expand All @@ -37,11 +37,11 @@
#' plot(model_sir)
#' @seealso epiworld-methods
ModelSIR <- function(
name, prevalence, infectiousness, recovery
name, prevalence, transmission_rate, recovery_rate
) {

structure(
ModelSIR_cpp(name, prevalence, infectiousness, recovery),
ModelSIR_cpp(name, prevalence, transmission_rate, recovery_rate),
class = c("epiworld_sir", "epiworld_model")
)

Expand Down
12 changes: 6 additions & 6 deletions R/ModelSIRCONN.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#' @param name String. Name of the virus
#' @param prevalence Double. Initial proportion of individuals with the virus.
#' @param contact_rate Numeric scalar. Average number of contacts per step.
#' @param prob_transmission Numeric scalar between 0 and 1. Probability of
#' @param transmission_rate Numeric scalar between 0 and 1. Probability of
#' transmission.
#' @param prob_recovery Numeric scalar between 0 and 1. Probability of recovery.
#' @param recovery_rate Numeric scalar between 0 and 1. Probability of recovery.
#' @param x Object of class SIRCONN.
#' @param ... Currently ignore.
#' @param n Number of individuals in the population.
Expand All @@ -20,8 +20,8 @@
#' n = 10000,
#' prevalence = 0.01,
#' contact_rate = 5,
#' prob_transmission = 0.4,
#' prob_recovery = 0.95
#' transmission_rate = 0.4,
#' recovery_rate = 0.95
#' )
#'
#' # Running and printing
Expand All @@ -31,12 +31,12 @@
#' plot(model_sirconn, main = "SIRCONN Model")
#' @seealso epiworld-methods
ModelSIRCONN <- function(
name, n, prevalence, contact_rate, prob_transmission, prob_recovery
name, n, prevalence, contact_rate, transmission_rate, recovery_rate
) {

structure(
ModelSIRCONN_cpp(name, n, prevalence, contact_rate,
prob_transmission, prob_recovery),
transmission_rate, recovery_rate),
class = c("epiworld_sirconn", "epiworld_model")
)

Expand Down
10 changes: 5 additions & 5 deletions R/ModelSIRLogit.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @param coef_infect_cols Integer vector. Columns in the coeficient.
#' @param coef_recover_cols Integer vector. Columns in the coeficient.
#' @param prob_infection Numeric scalar. Baseline probability of infection.
#' @param prob_recovery Numeric scalar. Baseline probability of recovery.
#' @param recovery_rate Numeric scalar. Baseline probability of recovery.
#' @param prevalence Numeric scalar. Prevalence (initial state) in proportion.
#'
#' @export
Expand All @@ -25,7 +25,7 @@
#' Female = sample.int(2, n, replace = TRUE) - 1
#' )
#'
#' # Declare coefficients for each sex regarding infectiousness and recovery.
#' # Declare coefficients for each sex regarding transmission_rate and recovery.
#' coef_infect <- c(.1, -2, 2)
#' coef_recover <- rnorm(2)
#'
Expand All @@ -38,7 +38,7 @@
#' coef_infect_cols = 1L:ncol(X),
#' coef_recover_cols = 1L:ncol(X),
#' prob_infection = .8,
#' prob_recovery = .3,
#' recovery_rate = .3,
#' prevalence = .01
#' )
#'
Expand Down Expand Up @@ -69,7 +69,7 @@ ModelSIRLogit <- function(
coef_infect_cols,
coef_recover_cols,
prob_infection,
prob_recovery,
recovery_rate,
prevalence
) {

Expand All @@ -83,7 +83,7 @@ ModelSIRLogit <- function(
coef_infect_cols - 1L,
coef_recover_cols - 1L,
prob_infection,
prob_recovery,
recovery_rate,
prevalence
),
class = c("epiworld_sir", "epiworld_model")
Expand Down
10 changes: 5 additions & 5 deletions R/ModelSIS.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#'
#' @param name String. Name of the virus.
#' @param prevalence Double. Initial proportion of individuals with the virus.
#' @param infectiousness Numeric scalar between 0 and 1. Virus's rate of
#' @param transmission_rate Numeric scalar between 0 and 1. Virus's rate of
#' infection.
#' @param recovery Numeric scalar between 0 and 1. Rate of recovery from virus.
#' @param recovery_rate Numeric scalar between 0 and 1. Rate of recovery from virus.
#' @param x Object of class SIS.
#' @param ... Currently ignore.
#' @export
Expand All @@ -16,7 +16,7 @@
#' @aliases epiworld_sis
#' @examples
#' model_sis <- ModelSIS(name = "COVID-19", prevalence = 0.01,
#' infectiousness = 0.9, recovery = 0.1)
#' transmission_rate = 0.9, recovery_rate = 0.1)
#'
#' # Adding a small world population
#' agents_smallworld(
Expand All @@ -36,10 +36,10 @@
#'
#' @seealso epiworld-methods
ModelSIS <- function(
name, prevalence, infectiousness, recovery) {
name, prevalence, transmission_rate, recovery_rate) {

structure(
ModelSIS_cpp(name, prevalence, infectiousness, recovery),
ModelSIS_cpp(name, prevalence, transmission_rate, recovery_rate),
class = c("epiworld_sis", "epiworld_model")
)

Expand Down
8 changes: 4 additions & 4 deletions R/ModelSURV.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' @param prop_vax_redux_infect Double. Factor by which the vaccine reduces
#' the chances of becoming infected.
#' @param surveillance_prob Double. Probability of testing an agent.
#' @param prob_transmission Double. Raw transmission probability.
#' @param transmission_rate Double. Raw transmission probability.
#' @param prob_death Double. Raw probability of death for symptomatic
#' individuals.
#' @param prob_noreinfect Double. Probability of no re-infection.
Expand All @@ -40,7 +40,7 @@
#' prop_vax_redux_transm = 0.8,
#' prop_vax_redux_infect = 0.95,
#' surveillance_prob = 0.1,
#' prob_transmission = 0.2,
#' transmission_rate = 0.2,
#' prob_death = 0.001,
#' prob_noreinfect = 0.5
#' )
Expand All @@ -65,13 +65,13 @@
ModelSURV <- function(
name, prevalence, efficacy_vax, latent_period, infect_period, prob_symptoms,
prop_vaccinated, prop_vax_redux_transm, prop_vax_redux_infect,
surveillance_prob, prob_transmission, prob_death, prob_noreinfect
surveillance_prob, transmission_rate, prob_death, prob_noreinfect
) {

structure(
ModelSURV_cpp(name, prevalence, efficacy_vax, latent_period, infect_period,
prob_symptoms, prop_vaccinated, prop_vax_redux_transm,
prop_vax_redux_infect, surveillance_prob, prob_transmission,
prop_vax_redux_infect, surveillance_prob, transmission_rate,
prob_death, prob_noreinfect),
class = c("epiworld_surv", "epiworld_model")
)
Expand Down
4 changes: 2 additions & 2 deletions R/agents-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#' n = 10000,
#' prevalence = 0.01,
#' contact_rate = 5,
#' prob_transmission = 0.4,
#' prob_recovery = 0.95
#' transmission_rate = 0.4,
#' recovery_rate = 0.95
#' )
#'
#' run(model_sirconn, ndays = 100, seed = 1912)
Expand Down
4 changes: 2 additions & 2 deletions R/agents.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#' @examples
#'
#' # Initializing SIR model with agents_smallworld
#' sir <- ModelSIR(name = "COVID-19", prevalence = 0.01, infectiousness = 0.9,
#' recovery = 0.1)
#' sir <- ModelSIR(name = "COVID-19", prevalence = 0.01, transmission_rate = 0.9,
#' recovery_rate = 0.1)
#' agents_smallworld(
#' sir,
#' n = 1000,
Expand Down
28 changes: 14 additions & 14 deletions R/cpp11.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,32 @@ get_generation_time_cpp <- function(model) {
.Call(`_epiworldR_get_generation_time_cpp`, model)
}

ModelSURV_cpp <- function(name, prevalence, efficacy_vax, latent_period, prob_symptoms, prop_vaccinated, prop_vax_redux_transm, infect_period, prop_vax_redux_infect, surveillance_prob, prob_transmission, prob_death, prob_noreinfect) {
.Call(`_epiworldR_ModelSURV_cpp`, name, prevalence, efficacy_vax, latent_period, prob_symptoms, prop_vaccinated, prop_vax_redux_transm, infect_period, prop_vax_redux_infect, surveillance_prob, prob_transmission, prob_death, prob_noreinfect)
ModelSURV_cpp <- function(name, prevalence, efficacy_vax, latent_period, prob_symptoms, prop_vaccinated, prop_vax_redux_transm, infect_period, prop_vax_redux_infect, surveillance_prob, transmission_rate, prob_death, prob_noreinfect) {
.Call(`_epiworldR_ModelSURV_cpp`, name, prevalence, efficacy_vax, latent_period, prob_symptoms, prop_vaccinated, prop_vax_redux_transm, infect_period, prop_vax_redux_infect, surveillance_prob, transmission_rate, prob_death, prob_noreinfect)
}

ModelSEIR_cpp <- function(name, prevalence, infectiousness, incubation_days, recovery) {
.Call(`_epiworldR_ModelSEIR_cpp`, name, prevalence, infectiousness, incubation_days, recovery)
ModelSEIR_cpp <- function(name, prevalence, transmission_rate, incubation_days, recovery_rate) {
.Call(`_epiworldR_ModelSEIR_cpp`, name, prevalence, transmission_rate, incubation_days, recovery_rate)
}

ModelSIS_cpp <- function(name, prevalence, infectiousness, recovery) {
.Call(`_epiworldR_ModelSIS_cpp`, name, prevalence, infectiousness, recovery)
ModelSIS_cpp <- function(name, prevalence, transmission_rate, recovery_rate) {
.Call(`_epiworldR_ModelSIS_cpp`, name, prevalence, transmission_rate, recovery_rate)
}

ModelSIRCONN_cpp <- function(name, n, prevalence, contact_rate, prob_transmission, prob_recovery) {
.Call(`_epiworldR_ModelSIRCONN_cpp`, name, n, prevalence, contact_rate, prob_transmission, prob_recovery)
ModelSIRCONN_cpp <- function(name, n, prevalence, contact_rate, transmission_rate, recovery_rate) {
.Call(`_epiworldR_ModelSIRCONN_cpp`, name, n, prevalence, contact_rate, transmission_rate, recovery_rate)
}

ModelSIR_cpp <- function(name, prevalence, infectiousness, recovery) {
.Call(`_epiworldR_ModelSIR_cpp`, name, prevalence, infectiousness, recovery)
ModelSIR_cpp <- function(name, prevalence, transmission_rate, recovery_rate) {
.Call(`_epiworldR_ModelSIR_cpp`, name, prevalence, transmission_rate, recovery_rate)
}

ModelSEIRCONN_cpp <- function(name, n, prevalence, contact_rate, prob_transmission, incubation_days, prob_recovery) {
.Call(`_epiworldR_ModelSEIRCONN_cpp`, name, n, prevalence, contact_rate, prob_transmission, incubation_days, prob_recovery)
ModelSEIRCONN_cpp <- function(name, n, prevalence, contact_rate, transmission_rate, incubation_days, recovery_rate) {
.Call(`_epiworldR_ModelSEIRCONN_cpp`, name, n, prevalence, contact_rate, transmission_rate, incubation_days, recovery_rate)
}

ModelSIRLogit_cpp <- function(vname, data, ncols, coefs_infect, coefs_recover, coef_infect_cols, coef_recover_cols, prob_infection, prob_recovery, prevalence) {
.Call(`_epiworldR_ModelSIRLogit_cpp`, vname, data, ncols, coefs_infect, coefs_recover, coef_infect_cols, coef_recover_cols, prob_infection, prob_recovery, prevalence)
ModelSIRLogit_cpp <- function(vname, data, ncols, coefs_infect, coefs_recover, coef_infect_cols, coef_recover_cols, prob_infection, recovery_rate, prevalence) {
.Call(`_epiworldR_ModelSIRLogit_cpp`, vname, data, ncols, coefs_infect, coefs_recover, coef_infect_cols, coef_recover_cols, prob_infection, recovery_rate, prevalence)
}

ModelDiffNet_cpp <- function(name, prevalence, prob_adopt, normalize_exposure, data, data_ncols, data_cols, params) {
Expand Down
4 changes: 2 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
#' n = 10000,
#' prevalence = 0.1,
#' contact_rate = 2.0,
#' prob_transmission = 0.8,
#' transmission_rate = 0.8,
#' incubation_days = 7.0,
#' prob_recovery = 0.3
#' recovery_rate = 0.3
#' )
#'
#' # Running the simulation for 50 steps (days)
Expand Down
8 changes: 4 additions & 4 deletions R/global-actions.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#' n = 10000,
#' prevalence = 0.01,
#' contact_rate = 5,
#' prob_transmission = 0.4,
#' prob_recovery = 0.95
#' transmission_rate = 0.4,
#' recovery_rate = 0.95
#' )
#'
#' # Creating a tool
Expand Down Expand Up @@ -45,8 +45,8 @@
#' n = 10000,
#' prevalence = 0.01,
#' contact_rate = 5,
#' prob_transmission = 0.4,
#' prob_recovery = 0.95
#' transmission_rate = 0.4,
#' recovery_rate = 0.95
#' )
#'
#' closure_day_10 <- globalaction_set_params("Contact rate", 0, day = 10)
Expand Down
2 changes: 1 addition & 1 deletion R/make_saver.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#' prevalence = 0.01,
#' n = 1000,
#' contact_rate = 2,
#' prob_transmission = 0.9, prob_recovery = 0.1
#' transmission_rate = 0.9, recovery_rate = 0.1
#' )
#'
#' # Generating a saver
Expand Down
4 changes: 2 additions & 2 deletions R/model-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ stopifnot_model <- function(model) {
#' n = 10000,
#' prevalence = 0.01,
#' contact_rate = 5,
#' prob_transmission = 0.4,
#' prob_recovery = 0.95
#' transmission_rate = 0.4,
#' recovery_rate = 0.95
#' )
#'
#' # Queuing - If you wish to implement the queuing function, declare whether
Expand Down
Loading