This function generates observation times
on a jittered grid:
occasion \(t = 0, \dots, T - 1\) of each person is measured at
\(\Delta t \left( t + u_{t} \right)\),
with \(u_{t} \sim U \left( - j, j \right)\),
as in stratified random sampling of ecological momentary assessments.
With jitter = 0, the schedule is the regular grid.
Arguments
- n
Positive integer. Number of individuals.
- time
Positive integer. Number of measurement occasions (at least 2).
- delta_t
Positive number. Spacing of the grid.
- jitter
Number in \(\left[ 0, 0.5 \right)\). Half-width of the uniform jitter, as a proportion of
delta_t. Values below 0.5 keep the occasions in order.
Value
Returns a list of length n.
Each element is a numeric vector of time observation times.
The attribute delta_t is a list of length n;
each element is a numeric vector of the time - 1 intervals.
Details
The times of each person are shifted to start at 0.
The attribute delta_t holds the intervals
for the delta_t argument of the continuous-time simulators,
for example, SimSSMOUFixed() and SimSSMLinSDEIVary().
For the same schedule for every person, use n = 1
and pass attr(x, "delta_t")[[1]].
See also
Other Measurement Design Functions:
ScheduleBurst(),
ScheduleExp(),
SimMissing()
Examples
set.seed(42)
schedule <- ScheduleRandom(n = 2, time = 5, delta_t = 1, jitter = 0.4)
schedule
#> [[1]]
#> [1] 0.000000 1.017815 1.497067 2.932513 3.781552
#>
#> [[2]]
#> [1] 0.000000 1.173994 1.692457 3.110317 4.148775
#>
#> attr(,"delta_t")
#> attr(,"delta_t")[[1]]
#> [1] 1.0178155 0.4792513 1.4354465 0.8490383
#>
#> attr(,"delta_t")[[2]]
#> [1] 1.1739939 0.5184626 1.4178606 1.0384580
#>