Skip to contents

Maximises the profile log-likelihood plus half the log determinant of the observed profile information. The penalty uses the negative profile Hessian, not an expected Fisher matrix. Scales stay concentrated out, so the penalty does not add a third free scale.

Usage

fit_firth_single_cell(
  y,
  mean_signature_matrix,
  Sigma,
  epsilon = 1e-08,
  itmax = 80L
)

Arguments

y

Bulk vector of length \(G\).

mean_signature_matrix

Reference mean, \(G\times J\).

Sigma

Cell-level covariances, \(G\times G\times J\).

epsilon

Relative function and step tolerances passed to stats::nlminb().

itmax

Maximum number of iterations.

Value

A list with coefficients, rho, loglik, penalty, penalised_loglik, mean_scale, variance_scale and convergence.

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)
fit_firth_single_cell(y, mu, sigma)$coefficients
#>       ct1       ct2 
#> 0.7053266 0.2946734