Are simulated sequences robust?
This function inserts a specified number of extra random uniforms into a sequence of calls to a generator, and checks whether the subsequent samples re-synchronize.
randomSlippage(nRuns, expr1, expr2, slip = runif(1), check = FALSE)
nRuns |
Number of runs for the comparison. |
expr1, expr2 |
The literal expressions to be evaluated before and after the possible slippage. |
slip |
The expression to be evaluated to cause the slippage; default |
check |
If |
The second generated result from evaluatging expr2
will resynchronize, if ever, after some number of values generated in the original and perturbed sequence, say k1
and k2
. At this point, each sequence returns exactly the same value because each has used the same number of uniforms; from that point on the sequences will be identical.
Re-synchronization need never occur; see the example in the reference.
The function returns a matrix with nRuns
rows and two columns. For each row, the returned value is the slippages, c(k1, k2)
in the Details.
set.seed(211) RNGkind("default", "Ahrens") xx = randomSlippage(1000, rnorm(20), rnorm(20)) table(xx[,1], xx[,2])
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.