algorithm2 {SpatialDecon} | R Documentation |
Runs the generic SpatialDecon decon workflow, including:
run deconvolution once
remove poorly-fit genes from first round of decon
re-run decon with cleaned-up gene set
compute p-values
algorithm2( Y, X, bg = 0, weights = NULL, resid_thresh = 3, lower_thresh = 0.5, align_genes = TRUE, maxit = 1000 )
Y |
p-length expression vector or p * N expression matrix - the actual (linear-scale) data |
X |
p * K Training matrix. |
bg |
Expected background counts. Provide a scalar to apply to all data points, or else a matrix/vector aligning with Y to provide more nuanced expected background. |
weights |
The same as the weights argument used by lm |
resid_thresh |
A scalar, sets a threshold on how extreme individual data points' values can be (in log2 units) before getting flagged as outliers and set to NA. |
lower_thresh |
A scalar. Before log2-scale residuals are calculated, both observed and fitted values get thresholded up to this value. Prevents log2-scale residuals from becoming extreme in points near zero. |
align_genes |
Logical. If TRUE, then Y, X, bg, and wts are row-aligned by shared genes. |
maxit |
Maximum number of iterations. Default 1000. |
a list:
beta: matrix of cell abundance estimates, cells in rows and observations in columns
sigmas: covariance matrices of each observation's beta estimates
p: matrix of p-values for H0: beta == 0
t: matrix of t-statistics for H0: beta == 0
se: matrix of standard errors of beta values
resids: a matrix of residuals from the model fit. (log2(pmax(y, lower_thresh)) - log2(pmax(xb, lower_thresh))).