mcmiso: Multivariable Isotonic Regression for Binary Data using...

View source: R/fun.R

mcmisoR Documentation

Multivariable Isotonic Regression for Binary Data using Inverse Projective Bayes with Parallel Computing

Description

A parallel computing wrapper for miso that uses mcComb to run the down-up ("DU") and up-down ("UD") algorithms simultaneously at each threshold grid point, returning the result of whichever finishes first. While the two algorithms may produce different classification rules at each threshold, they are guaranteed to achieve the same maximum log posterior gain (Cheung and Kuhn, in press). This approach reduces elapsed time without sacrificing accuracy and is most effective for large datasets where the number of unique feature combinations K is large (typically K > 500).

Usage

mcmiso(X, y, incr = 0.01)

Arguments

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 nrow(X) indicating the observed outcome for each observation (1 = event, 0 = no event).

incr

a numeric value in (0,1) specifying the increment between threshold grid points used to invert the classifier. Smaller values yield finer resolution at the cost of increased computation time. Defaults to 0.01.

Details

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. When run from RStudio, future::multisession is used automatically but incurs higher overhead due to session launching costs compared to future::multicore available in a terminal.

Value

A list containing the same components as miso, based on whichever of the "DU" or "UD" algorithm finishes first at each threshold grid point:

alldoses

a numeric matrix of unique feature combinations observed in the training data

M

a numeric vector of observation counts at each feature combination

S

a numeric vector of event counts at each feature combination

thetahat

a numeric vector of estimated response probabilities at each unique feature combination, monotone nondecreasing with respect to the partial ordering of the features

nt

an integer giving the number of threshold grid points used, equal to round(1/incr) + 1

logH

a numeric vector of length nt giving the log posterior gain of the optimal classification at each threshold grid point

References

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.

Examples

## 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 <- mcmiso(X, y)
future::plan(future::sequential)  # restore default plan when done

## End(Not run)

McMiso documentation built on April 4, 2026, 1:07 a.m.

Related to mcmiso in McMiso...