630 research outputs found
R friendly multi-threading in C++
Calling multi-threaded C++ code from R has its perils. Since the R
interpreter is single-threaded, one must not check for user interruptions or
print to the R console from multiple threads. One can, however, synchronize
with R from the main thread. The R package RcppThread (current version 0.5.3)
contains a header only C++ library for thread safe communication with R that
exploits this fact. It includes C++ classes for threads, a thread pool, and
parallel loops that routinely synchronize with R. This article explains the
package's functionality and gives examples of its usage. The synchronization
mechanism may also apply to other threading frameworks. Benchmarks suggest
that, although synchronization causes overhead, the parallel abstractions of
RcppThread are competitive with other popular libraries in typical scenarios
encountered in statistical computing
An Online Bootstrap for Time Series
Resampling methods such as the bootstrap have proven invaluable in the field
of machine learning. However, the applicability of traditional bootstrap
methods is limited when dealing with large streams of dependent data, such as
time series or spatially correlated observations. In this paper, we propose a
novel bootstrap method that is designed to account for data dependencies and
can be executed online, making it particularly suitable for real-time
applications. This method is based on an autoregressive sequence of
increasingly dependent resampling weights. We prove the theoretical validity of
the proposed bootstrap scheme under general conditions. We demonstrate the
effectiveness of our approach through extensive simulations and show that it
provides reliable uncertainty quantification even in the presence of complex
data dependencies. Our work bridges the gap between classical resampling
techniques and the demands of modern data analysis, providing a valuable tool
for researchers and practitioners in dynamic, data-rich environments
- …