Estimates cell-specific proportions given known proportions expression signatures, using least-squares fitting.
gedAlgorithm.cs_lsfit(..., rescale = TRUE, fit = c("ls", "nnls"))
.nn_lsfit
or .fcnnls
.TRUE
) or left as estimated by the linear
regression (FALSE
). This scaling is performed
after the coefficients have been forced to be
nonnegative.ls
uses
lm
, nnls
uses
fcnnls
.The algorithm applies the same methods as the ged
algorithm lsfit
but to the
transposed problem of estimating signatures from
proportions. It is included in the CellMix package
for test/experimental purposes.
# random target matrix
x <- rmatrix(100, 20)
# random cell proprtions
p <- rmatrix(3, 20)
# deconvolve using standard least-squares
res <- ged(x, p, 'cs-lsfit')
head(basis(res))
## [,1] [,2] [,3]
## [1,] 0.46277 0.4749 0.08808
## [2,] 0.32924 0.4077 0.23206
## [3,] 0.01626 0.5285 0.47800
## [4,] 0.53150 0.4500 0.09519
## [5,] 0.16005 0.5324 0.41598
## [6,] 0.40514 0.5402 0.12278
# proportions are not updated
identical(coef(res), p)
## [1] TRUE
## Don't show:
stopifnot(identical(coef(res), p))
stopifnot( nmf.equal(res, ged(x, p, 'cs-lsfit')) )
## End Don't show
# deconvolve using nonnegative least-squares
res <- ged(x, p, 'cs-lsfit', fit = 'nnls')
head(basis(res))
## [,1] [,2] [,3]
## [1,] 0.46277 0.4749 0.08808
## [2,] 0.32924 0.4077 0.23206
## [3,] 0.01626 0.5285 0.47800
## [4,] 0.53150 0.4500 0.09519
## [5,] 0.16005 0.5324 0.41598
## [6,] 0.40514 0.5402 0.12278
# proportions are not updated
identical(coef(res), p)
## [1] TRUE
## Don't show:
stopifnot(identical(coef(res), p))
stopifnot( nmf.equal(res, ged(x, p, 'cs-lsfit', fit = 'nnls'), tolerance = 10^-15) )
## End Don't show