
Random probability function with day of week effect
Source:R/simulation-utils.R
cfg_weekly_proportion_rng.Rd
This function returns a random probability generator that has a weekly period and configurable degree of additional variability around weekly pattern. It is suited to probabilities of things like testing which may depend on the day of week.
Value
a random number generator function taking t
time parameter and
returning a probability of ascertainment for that time, depending on day of
week etc.
Examples
fn = cfg_weekly_proportion_rng(c(0.9,0.9,0.9,0.9,0.9,0.1,0.1))
matrix(fn(1:42),ncol=7,byrow=TRUE)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 0.8922862 0.8885387 0.8900636 0.9029377 0.9076043 0.10804019 0.10095954
#> [2,] 0.9194989 0.9109547 0.8909060 0.8987678 0.8971401 0.09693485 0.09370012
#> [3,] 0.9031454 0.9075204 0.9015756 0.8923697 0.8790933 0.09250077 0.10036518
#> [4,] 0.9002606 0.8832253 0.8804737 0.9161453 0.9146846 0.09138843 0.12451528
#> [5,] 0.8821821 0.9032120 0.8945146 0.9068591 0.9122709 0.10607827 0.08572542
#> [6,] 0.8991226 0.8999506 0.8903531 0.8927611 0.9038220 0.10898652 0.08730289