Open-simplex start for ILR solvers
Source:R/03_03_DeCovarT_estimate_ratios_frequentist.R
starting_simplex.RdThe convolution log-likelihood is not globally concave, so the start
can change which basin the solver enters. Draw several independent
Dirichlet starts (different RNG streams or
multistart_decovart()) rather than a single draw when probing
multimodality.
Usage
starting_simplex(
n_celltypes,
initial_p = NULL,
nms = NULL,
y = NULL,
mean_signature_matrix = NULL,
dirichlet_alpha = 1
)Arguments
- n_celltypes
Integer \(J\).
- initial_p
One of:
NULLor"barycentre": equi-balanced \((1/J,\ldots,1/J)\);a numeric vector of length \(J\): used as-is after
repair_simplex();"dirichlet": one Dirichlet\((\alpha,\ldots,\alpha)\) draw (seedirichlet_alpha);"qp"(aliases"deconrnaseq","lsei"): mean-only simplex QP fromdeconvolute_ratios_deconrnaseq()(yandmean_signature_matrixrequired).
- nms
Optional names (cell-type colnames).
- y, mean_signature_matrix
Bulk and signature, required for a QP start.
- dirichlet_alpha
Positive concentration, recycled to length \(J\). The default
1is uniform on the simplex. \(\alpha>1\) concentrates mass near the barycentre; \(\alpha<1\) puts extra mass near faces (boundary-biased restarts).
Examples
starting_simplex(3L)
#> [1] 0.3333333 0.3333333 0.3333333
set.seed(1)
starting_simplex(3L, "dirichlet")
#> ct1 ct2 ct3
#> 0.04037978 0.48994649 0.46967373