The initial state of the system is initialized at the first observation time, either with a fixed vector of compartment counts, or is sampled by drawing the initial compartment counts from a dirichlet-multinomial distribution for a Markov jump process (MJP), or by the normal approximation to the dirichlet-multinomial (LNA/ODE). If the initial state is not fixed and no prior is specified, then the hyperparameters are handled internally as follows: For the MJP, if the multinomial hyperprior parameters are not specified, the normalized probabilities are computed from the init_states vector and used in the prior slot. For the LNA or ODE, the init_state vector is used to construct the multivariate normal approximation of the multinomial.

stem_initializer(
  init_states,
  fixed,
  strata = NULL,
  prior = NULL,
  dist = "multinom"
)

Arguments

init_states

named vector of initial compartment counts (MJP) or volumes (LNA).

fixed

should the vector of compartment counts be treated as random?

strata

character vector strata to which the vector of initial compartment counts or probabilities applies, possibly "ALL".

prior

hyperparameters for state probabilities at time t0.

dist

one of "multinom" if the initial distribution (or its normal approximation) is multinomial, "dirmultinom" if dirichlet-multinomial, or "sbln" if stick-breaking logit-normal.

Value

list of settings used to initialize the initial state at the first observation time.

Examples

# Random initial state where for a single subject P(X_j=S)=0.5,P(X_j=I)=0.2,
# P(X_j=R=0.3), and one set of initial state probabilities govern the
# distribution of initial compartment counts in all strata:
stem_initializer(c(S=500, I = 200, R = 300), fixed = FALSE, strata = "ALL")
#> $init_states
#>   S   I   R 
#> 500 200 300 
#> 
#> $fixed
#> [1] FALSE
#> 
#> $strata
#> [1] "ALL"
#> 
#> $prior
#> NULL
#> 
#> $dist
#> [1] "multinom"
#> 

# All strata are of size 1000. At the first observation time, there are 200
# susceptible, 100 infected, and 700 recovered adults, and there are 900
# susceptibles children, 50 infected children, and 50 recovered children:
list(stem_initializer(c(S=200,I=100,R=700), fixed = TRUE, strata = "adults"),
     stem_initializer(c(S=900,I=50,R=50), fixed=TRUE, strata = "children"))
#> [[1]]
#> [[1]]$init_states
#>   S   I   R 
#> 200 100 700 
#> 
#> [[1]]$fixed
#> [1] TRUE
#> 
#> [[1]]$strata
#> [1] "adults"
#> 
#> [[1]]$prior
#> NULL
#> 
#> [[1]]$dist
#> [1] "multinom"
#> 
#> 
#> [[2]]
#> [[2]]$init_states
#>   S   I   R 
#> 900  50  50 
#> 
#> [[2]]$fixed
#> [1] TRUE
#> 
#> [[2]]$strata
#> [1] "children"
#> 
#> [[2]]$prior
#> NULL
#> 
#> [[2]]$dist
#> [1] "multinom"
#> 
#>