startvec: Build initial population vector

View source: R/startvec.R

startvecR Documentation

Build initial population vector

Description

startvec returns two objects: u0, a data.frame of initial demographic, epidemiological and immunity states of the population, and ldata: matrix with local (ward-level) parameters required by SimInf package. ldata contains for each ward the proportion of time spent by professionals of the ward X in the different wards (H_dest_X) and the origin ward proportions for the professionals acting in the ward X (H_origine_X). In a disconnected facility, H_dest_X and H_origin_X will be equal to 1 (professionals of the ward only work in ward X and all professionals working in the ward X are affiliated to ward X). nP the number of beds in each ward, nV the average number of visit per patient per day, tLS the average length of stay in each ward. u0 describes the distribution of patients and professionals in the different wards and compartments (compartments are detailed in the vignette). By default all patients and professionals are susceptible and non immune. Other states can be specified using IMMstate and EPIstate.

Usage

startvec(ward_names, pop_size_P, pop_size_H, nVisits, LS,
          matContact = NULL, IMMstate = NULL, EPIstate = NULL,
          SA = FALSE, nH_SA = NULL, verbose = TRUE)

Arguments

ward_names

String vector. Contains ward ids.

pop_size_P

Numerical vector. Contains the number of beds per ward (ordered as ward_names).

pop_size_H

Numerical vector. Contains the number of professionals affiliated to each ward (ordered as ward_names).

nVisits

Numerical vector. Contains the average daily numbers of visits per ward (ordered as ward_names).

LS

Numerical vector. Contains the average length of stay per ward (in days, ordered as ward_names).

matContact

Square matrix. Contains the average proportion of time ( Wards order in rows and columns must be ordered as ward_names. Row sums should be equal to 1. Use randomContacts to generate an example. Default is NULL (wards are disconnected; professionals are not shared between wards).

IMMstate

Data.frame. Contains 4 columns specifying immunity of patients and professionals: ward: defines the ward as identified in ward_names vector. pop: defines the subpopulation either patients ("P") or professionals ("H"). imm: defines the immunity level either non immunity ("NI"), low immunity ("LI") or high immunity ("HI"). n: defines the number of individuals in that state. Default is NULL (all individuals are considered non immune).

EPIstate

Data.frame. Contains 5 columns specifying epidemiological state for patients and professionals and any subpopulation: ward: defines the ward as identified in ward_names vector. pop: defines the subpopulation either patients ("P") or professionals ("H"). imm: defines the immunity level either non immunity ("NI"), low immunity ("LI") or high immunity ("HI"). epi: defines the epidemiological state: incubating non infectious ("E"), incubating infectious future asymptomatic ("EA"), incubating infectious future symptomatic ("ES"), infectious asymptomatic ("IA"), infectious with mild symptoms ("IM"), infectious with severe symptoms ("IS"). n: defines the number of individuals in that state. Default is NULL (all individuals are considered susceptible).

SA

Logical. Activate the implementation of a screening area at the admission: contact are restricted (no contact with other patients of the ward) before clinical diagnostic and test. Default is FALSE.

nH_SA

Numerical vector. Contains the number of professionals in charge of admissions in the screening area when implemented (SA = TRUE).

verbose

Logical. Activate messages display.

Value

List

Examples

data("toydata")
list2env(toydata,envir=.GlobalEnv)
gdata <- build_gdata()

matContact <- randomContacts(pop_size_H, ward_names)$contactMat

IMMstate <- data.frame(
ward = c("a", "c", "b"),
pop = c("P","P", "H"),
imm = c("LI", "HI", "HI"),
n = c(3, 2, 10)
)
EPIstate <- data.frame(
ward = c("b", "d"),
pop = c("P","H"),
imm = c("NI", "NI"),
epi = c("E", "E"),
n = c(1, 1)
)

## Disconnected wards all susceptible and non immune, no screening area at the admission
startvec(ward_names, pop_size_P, pop_size_H, nVisits, LS,
         matContact = NULL, IMMstate = NULL, EPIstate = NULL,
         SA = FALSE, nH_SA = NULL, verbose = FALSE)

## Connected wards all susceptible and non immune, no screening area at the admission
startvec(ward_names, pop_size_P, pop_size_H, nVisits, LS,
         matContact = matContact, IMMstate = NULL, EPIstate = NULL,
         SA = FALSE, nH_SA = NULL, verbose = FALSE)

## Connected wards all susceptible but with immune individuals, no screening area at the admission
startvec(ward_names, pop_size_P, pop_size_H, nVisits, LS,
         matContact = matContact, IMMstate = IMMstate, EPIstate = NULL,
         SA = FALSE, nH_SA = NULL, verbose = FALSE)

## Connected wards with immune and infected individuals, no screening area at the admission
startvec(ward_names, pop_size_P, pop_size_H, nVisits, LS,
         matContact = matContact, IMMstate = IMMstate, EPIstate = EPIstate,
         SA = FALSE, nH_SA = NULL, verbose = FALSE)

## Connected wards with immune and infected individuals, including the implementation of a
## screening area at the admission with one professional in charge of admission per ward
startvec(ward_names, pop_size_P, pop_size_H, nVisits, LS,
         matContact = matContact, IMMstate = IMMstate, EPIstate = EPIstate,
         SA = TRUE, nH_SA = rep(1, 5), verbose = FALSE)


MESuRS-Lab/mwss documentation built on Sept. 12, 2023, 12:08 a.m.