Noah Greifer updated thepackage source to reflecttwochanges to the CRAN checks that resulted inbcf beingremoved from CRAN in April 2023. Noah’s updates:
sprintf() from the C++ source code, as it isnow deprecated, andCXX_STD = CXX11 fromsrc/Makevarsandsrc/Makevars.win, as C++11 is now a CRAN default.The prediction method introduced in the previousbcfversion writes tree samples to text files, which can grow large if manysamples are retained. Users concerned about the size of text fileoutputs may suppress writing to text files by specifyingno_output = TRUE in the call tobcf().
Sampling employs within-chain parallelism throughRcppParallel, butbcf does not, for the timebeing, run multiple chains in parallel through R’s high leveldoParallel interface.
This implementation extends existingbcf functionalityby:
coda packageThe original version ofbcf does not allow for weights,which are often used in practical applications to account forheteroskedasticity. Where the original BCF model was specified as:
yi ∼ N(μ(xi) + τ(xi) zi,σ2),
which assumes that all outcomes yi have the same varianceσ2, in the extended version we can relax this assumption toallow for heteroskedasticity in yi:
yi ∼ N(μ(xi) + τ(xi) zi,σ2/wi)
Incorporating weights impacts several parts of the code, includingthe computation of:
In Bayesian analysis, it is useful to produce different runs of thesame model – with different starting values – as a way of assessingconvergence. If the different runs produce drastically differentposterior distributions, it is a sign that the model has not convergedfully. In this version ofbcf we have automated multichainprocessing and incorporated key MCMC diagnostics from thecoda package, including effective sample sizes and theGelman-Rubin statistic (“R hat”).
Finally, our implementation conducts some steps of the samplingprocedure in parallel to maximize computational efficiency. Our testingshows that these enhancements have reduced runtimes by around 50%,across various experimental conditions.
It is now possible to predict the treatment effect for a new set ofunits. Once users have produced a satisfactorybcf run(using training data), they can use this fittedbcf objectto predict on a new set of test data. This is possible even with runsthat have multiple chains.