Parametric bootstrap for one single-cell bulk sample
Source:R/03_04_single_cell_inference.R
bootstrap_single_cell.RdDraws \(\boldsymbol{Y}^{(b)}\sim\mathcal{N}(\hat c\tilde{\boldsymbol{\mu}} \hat{\boldsymbol{p}},\hat\phi\boldsymbol{S}_W(\hat{\boldsymbol{p}}))\) and refits the profile model. Percentile intervals are returned for the composition and for the two scales. The reference moments stay fixed.
Usage
bootstrap_single_cell(
y,
mean_signature_matrix,
Sigma,
n_boot = 200L,
level = 0.95,
epsilon = 1e-06,
itmax = 40L,
optimiser = c("newton", "lbfgsb")
)Arguments
- y
Bulk vector of length \(G\).
- mean_signature_matrix
Reference mean, \(G\times J\).
- Sigma
Cell-level covariances, \(G\times G\times J\).
- n_boot
Number of replicates.
- level
Confidence level.
- epsilon
Relative function and step tolerances passed to
stats::nlminb().- itmax
Maximum number of iterations.
- optimiser
Passed to
deconvolute_single_cell()for the fit and every refit, so the bootstrap matches the estimator being assessed.
Value
A list with estimates, interval, n_failed (refits that
errored, left as NA columns), scales, scale_interval and fit.
scales and scale_interval have rows mean_scale (\(c\)),
variance_scale (\(\phi\)), platform_scale_a
(\(a=\phi/c\)) and cell_count_n (\(n=c^{2}/\phi\)).
See also
confint_single_cell(), bootstrap_decovart()
Other decovart_inference:
bootstrap_decovart(),
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(),
reference_bootstrap_single_cell(),
restricted_mle_decovart(),
restricted_mle_single_cell()
Examples
mu <- matrix(c(2, 0.2, 0.2, 2, 0.2, 3, 0.2, 3), nrow = 4)
colnames(mu) <- c("ct1", "ct2")
sigma <- array(rep(diag(0.05, 4), 2), c(4, 4, 2))
y <- 20 * drop(mu %*% c(0.7, 0.3)) + c(0.3, -0.2, 0.1, -0.1)
set.seed(1)
bootstrap_single_cell(y, mu, sigma, n_boot = 5)$interval
#> 2.5% 97.5%
#> ct1 0.7045195 0.7066303
#> ct2 0.2933697 0.2954805