Reference bootstrap for the single-cell mixture
Source:R/03_04_single_cell_inference.R
reference_bootstrap_single_cell.RdResamples the reference that produced
\((\tilde{\boldsymbol{\mu}},\boldsymbol{\Sigma}_j)\) and refits
deconvolute_single_cell(). resample = NULL uses donors when every
cell type has at least two donor labels, and otherwise resamples
columns within each cell type. The within-type resample regenerates
the bulk from the fitted single-cell law, at the original
\((\hat{\boldsymbol{p}},\hat c,\hat\phi)\) and the original
moments, and refits it with the resampled moments, so that both the
bulk noise and the reference error enter the interval.
Shuffling cell-type names is not a reference bootstrap. It does not
redraw cells or donors, and the likelihood is equivariant under a
relabeling, so the draw would not be a source of uncertainty. That
check remains equivariance_check_decovart() for the population model.
Usage
reference_bootstrap_single_cell(
y,
reference_profiles,
donor_ids = NULL,
resample = NULL,
n_boot = 100L,
level = 0.95,
regenerate_bulk = NULL,
ridge = 1e-06,
epsilon = 1e-06,
itmax = 40L
)Arguments
- y
Bulk vector of length \(G\).
- reference_profiles
Named list of gene-by-cell (or gene-by-replicate) matrices, one per cell type.
- donor_ids
Optional list of donor labels, aligned with
reference_profiles.- resample
"donors","cells", orNULLfor the automatic rule above.- n_boot
Number of replicates.
- level
Confidence level.
- regenerate_bulk
NULLregenerates the bulk only for the within-type resample.TRUEorFALSEoverrides that rule.- ridge
Ridge passed to the sample covariance, relative to its mean diagonal.
- epsilon
Relative function and step tolerances passed to
stats::nlminb().- itmax
Maximum number of iterations.
Value
A list with resample, regenerate_bulk, estimates,
interval, n_failed, scales, scale_interval and fit;
scales and scale_interval also carry the derived rows
platform_scale_a and cell_count_n.
See also
reference_bootstrap_decovart(), confint_single_cell()
Other decovart_inference:
bootstrap_decovart(),
bootstrap_single_cell(),
boundary_diagnostics(),
chi_bar_square_pvalue(),
confint_decovart(),
confint_ilr_backtransform(),
confint_profile_decovart(),
confint_profile_single_cell(),
confint_single_cell(),
equivariance_check_decovart(),
fit_firth_decovart(),
fit_firth_single_cell(),
lrt_decovart(),
lrt_single_cell(),
multistart_decovart(),
reference_bootstrap_decovart(),
restricted_mle_decovart(),
restricted_mle_single_cell()
Examples
set.seed(1)
mu <- cbind(ct1 = c(2, 2, 0.2, 0.2), ct2 = c(0.2, 0.2, 3, 3))
sigma <- array(rep(diag(0.05, 4), 2), c(4, 4, 2))
refs <- lapply(seq_len(2), function(j) {
t(MASS::mvrnorm(n = 6, mu = mu[, j], Sigma = sigma[, , j]))
})
names(refs) <- colnames(mu)
y <- 20 * drop(mu %*% c(0.7, 0.3)) + rnorm(4, sd = 0.2)
reference_bootstrap_single_cell(y, refs, n_boot = 4)$resample
#> [1] "cells"