Skip to contents

Expands the design matrix X using cell type proportions lambda, applying scaling for sequencing depth and removing low-frequency features.

Usage

expand_covariate_matrix(
  X,
  lambda,
  family = "gaussian",
  keep_coef = matrix(TRUE, ncol(X), ncol(lambda)),
  lib_size = rep(1, nrow(X)),
  min_reads_per_1000 = 1,
  max_noise_sd = 1
)

Arguments

X

Covariate matrix of dimension (n times p)

lambda

Matrix of cell type proportions (n x k)

family

Model family: "poisson", "negative binomial", or "gaussian"

keep_coef

Matrix (p by k) indicating which coefficients to keep in case one knows what to remove a priori(default: all TRUEs)

lib_size

Library sizes for each sample (default: 1 for all)

min_reads_per_1000

If family == "poisson" or "negative binomial" Minimum reads per 1000 for robust scaling (default: 1)

max_noise_sd

If family == "gaussian" maximum standard deviation of the error term to be used for robust scaling (default: 1)

Value

A scaled and expanded covariate matrix