| mcPBclassifier | R Documentation |
A parallel computing wrapper for PBclassifier that runs the
down-up ("DU") and up-down ("UD") algorithms simultaneously
in parallel and returns the result of whichever finishes first. Since both
algorithms are guaranteed to achieve the same maximum log posterior gain,
i.e. the same logH (Cheung and Kuhn in press), this approach reduces
elapsed time without sacrificing optimality.
mcPBclassifier(X, y, a0 = 0.5, b0 = 0.5, t0 = 0.5)
X |
a numeric matrix of observed feature combinations, one row per observation, where repeated rows are expected. Each column represents a feature (e.g., a dose component or experimental factor) and each row represents the feature combination observed for one unit. |
y |
a binary numeric vector of length |
a0 |
a positive numeric value specifying the shape1 hyperparameter of the Beta prior in the Beta-Binomial conjugate model. Defaults to 0.5 (Jeffreys prior). |
b0 |
a positive numeric value specifying the shape2 hyperparameter of the Beta prior in the Beta-Binomial conjugate model. Defaults to 0.5 (Jeffreys prior). |
t0 |
a numeric value in (0,1) specifying the threshold on the response rate used to classify each feature combination as event or no-event. Defaults to 0.5. |
Before calling this function, the user must set up a parallel plan using
future::plan. The recommended plan is future::multisession
which works across all platforms including Windows. The future
package must be installed separately (install.packages("future")).
After the analysis is complete, it is good practice to restore the default
sequential plan using future::plan(future::sequential).
Note that parallel overhead may outweigh the benefit for small datasets.
This function is most effective when the number of unique feature
combinations K is large (typically K > 500) and when
run from a terminal rather than RStudio, where future::multicore
(forking) is available. In RStudio, future::multisession is used
automatically but incurs higher overhead due to session launching costs.
A list of class "pbc" containing the same components as
PBclassifier, based on whichever of the "DU" or
"UD" algorithm finishes first.
Cheung YK, Diaz KM. Monotone response surface of multi-factor condition: estimation and Bayes classifiers. J R Stat Soc Series B Stat Methodol. 2023 Apr;85(2):497-522. doi: 10.1093/jrsssb/qkad014. Epub 2023 Mar 22. PMID: 38464683; PMCID: PMC10919322.
Cheung YK, Kuhn L. Evaluating multiplex diagnostic test using partially ordered Bayes classifier. Ann Appl Stat. In press.
## Not run:
# install.packages("future") # if not already installed
future::plan(future::multisession) # set up parallel plan first
A <- as.matrix(expand.grid(rep(list(0:1), 6)))
set.seed(2025)
X <- A[sample(nrow(A), size=500, replace=TRUE),]
y <- as.numeric(rowSums(X) >= 3)
fit <- mcPBclassifier(X, y)
future::plan(future::sequential) # restore default plan when done
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.