
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.8996348 0.9002606 0.8832253 0.8804737 0.9161453 0.08531543 0.09138843
#> [2,] 0.8754847 0.8821821 0.9032120 0.8945146 0.9068591 0.08772913 0.10607827
#> [3,] 0.9142746 0.8991226 0.8999506 0.8903531 0.8927611 0.09617796 0.10898652
#> [4,] 0.9126971 0.8906152 0.9050802 0.8884533 0.9052898 0.09780647 0.10047323
#> [5,] 0.9008940 0.9016618 0.8891548 0.8886515 0.8926083 0.09433257 0.10610750
#> [6,] 0.9014417 0.9031397 0.8910388 0.8780175 0.9045683 0.11981683 0.09081438