Skip to contents

Forms a Wald interval for the unconstrained ILR coordinate \(\boldsymbol{\rho}\) from the expected Fisher information, then maps it to the simplex by the inverse chart \(\boldsymbol{\psi}\). For two cell types the map is monotone, so the endpoints of the interval for \(\rho\) are transformed. For more than two cell types the joint normal draw \(\boldsymbol{\rho}^{(b)}\) is transformed and the interval is the marginal quantile of \(\boldsymbol{\psi}(\boldsymbol{\rho}^{(b)})\). Every transformed draw is a composition, so the interval lies in \((0,1)\).

This is the default of confint_decovart(). The symmetric delta-method interval on \(\boldsymbol{p}\) remains confint.decovart_fit(). Columns of y are replicates that share one composition: their number multiplies the Fisher information.

Usage

confint_ilr_backtransform(
  y,
  mean_signature_matrix,
  Sigma,
  p = NULL,
  level = 0.95,
  n_draws = 2000L,
  seed = NULL,
  epsilon = 10^-8,
  itmax = 500L
)

Arguments

y

Numeric vector of length \(G\), or \(G\times N\) matrix of replicate bulk profiles that share one composition; their log-likelihoods are summed (the pooled, population-level fit).

mean_signature_matrix

Numeric matrix \(\boldsymbol{\mu}\in\mathcal{M}_{G\times J}\) (plug-in means).

Sigma

Array of cell-type covariances in \(\mathcal{M}_{G\times G\times J}\).

p

Composition at which to evaluate the information. NULL uses the pooled maximum likelihood estimate.

level

Confidence level.

n_draws

Monte Carlo size used when there are three or more cell types. Ignored for two cell types.

seed

Optional seed for the Monte Carlo map. The previous random-number state is restored. NULL leaves the state unchanged and draws from the current stream.

epsilon, itmax

Relative convergence tolerance and iteration budget passed to stats::nlminb().

Value

A list with estimate, interval on the simplex, rho, rho_interval (component-wise Wald bounds for \(\boldsymbol{\rho}\)), vcov_rho, vcov, mapping ("endpoint" or "monte_carlo") and n_obs. On a simplex face the interval is NA.

Examples

mu <- matrix(c(20, 40, 15, 40, 20, 25), nrow = 3)
colnames(mu) <- paste0("ct", 1:2)
Sigma <- array(c(diag(3), diag(3)), dim = c(3, 3, 2))
y <- drop(mu %*% c(0.6, 0.4))
confint_ilr_backtransform(y, mu, Sigma)$interval
#>          2.5%     97.5%
#> ct1 0.5514710 0.6453814
#> ct2 0.3546186 0.4485290