Parallel test execution helper¶
Source: R/performance.R ยท Help: ?runHeteroTestsParallel
Executes a set of registered diagnostics in parallel when multiple CPU cores are available, falling back to sequential execution otherwise.
Usage¶
Arguments¶
model- Fitted model object passed to each diagnostic. Must be compatible
with the internal
.test_factoryregistry. data- Data frame used to fit
modeland supplied to each diagnostic. tests- Character vector naming the diagnostics to execute.
n_cores- Optional positive integer giving the number of worker processes
to spawn. Defaults to
parallel::detectCores() - 1, with a lower bound of 1.
Value¶
Named list of test results in the order provided by tests. Each
is the result runHeteroTests() gives for that test on the same call,
its numbers computed the same way, since 0.18.0, and so identical() to
it where the BLAS gives the same last bits on every call, as R's
reference BLAS does (Intel MKL need not): a result whose data.name is
"model", the name of the
argument of the function the registry calls the test with, reports the
formula of the model instead, and attr(, "extras")$streaming is
FALSE, as this function runs the exact tests only. Before, White's test,
its bootstrap, the studentized Breusch-Pagan statistic and Szroeter's test
reported "model" here. A resampling test draws from a stream of its own
(Details), and so does not return the value it returns in
runHeteroTests(), which draws from the session's generator. The list
is not a hetero_test_suite, and a test that fails stops the call,
without the fallbacks of runHeteroTests().
Details¶
When n_cores exceeds one the diagnostics run on a socket cluster of that
many workers (parallel::makeCluster()), started for the call, each of which
loads the installed heteroTests. The model and the data travel to the
workers with each task. With n_cores = 1, or when the default comes to one
worker, the diagnostics run in the session.
Test i draws its random numbers from stream i of a L'Ecuyer-CMRG
generator seeded by one draw from the session's generator, on the workers
and in the session alike. A seeded call that runs a resampling test, such as
"wild_bootstrap", therefore returns the same value each time and whatever
n_cores, n_cores = 1 included. It is not the value that test returns
when called directly from the same seed, which draws from the session's
generator; both are bootstraps of the same data.
See also¶
cachedTest() for memoised execution of individual diagnostics.