These are the available incidence functions. t is relative to time 0. So, to get incidence 2 years ago, t = -2.

simCrossSect(
  phi.func,
  incidence_type,
  prevalence,
  baseline_incidence,
  rho = NA,
  bigT = NA
)

Arguments

incidence_type

Incidence type: constant, linear, exponential, or linear-constant (constant up to bigT argument, linear after)

prevalence

Constant prevalence

baseline_incidence

Baseline incidence

rho

Parameter for linear or exponentially decreasing incidence

n_sims

Number of simulations

n

Number of observations per time point

p

Constant prevalence

t

Time t baseline (defaults to 0)

Details

Constant incidence: $$\lambda(t) = \lambda_0 - \rho$$ Linear incidence: $$\lambda(t) = \lambda_0 - \rho t$$ Exponential incidence: $$\lambda(t) = \lambda_0 \exp(-\rho t)$$ Constant-linear incidence: $$\lambda(t) = \lambda_0 - \rho (t + T^*) I(-t > T^*)$$

Examples

phi.func <- getTestRecentFunc(window=200, shadow=191)
sim <- simCrossSect(phi.func=phi.func,
                    incidence_type="linear", prevalence=0.29, baseline_incidence=0.032, rho=0.07)
sim(10)
#>    di        ui ri
#> 1   0        NA NA
#> 2   0        NA NA
#> 3   0        NA NA
#> 4   0        NA NA
#> 5   0        NA NA
#> 6   0        NA NA
#> 7   0        NA NA
#> 8   0        NA NA
#> 9   0        NA NA
#> 10  1 0.7248768  0