tensor {Unico} | R Documentation |
Inferring the underlying source-specific 3D tensor
Description
Infers the underlying (sources by features by observations) 3D tensor from the observed (features by observations) 2D mixture, under the assumption of the Unico model that each observation is a mixture of unique source-specific values (in each feature in the data). In the context of bulk genomics containing a mixture of cell types (i.e. the input could be CpG sites by individuals for DNA methylation and genes by individuals for RNA expression), tensor
allows to estimate the cell-type-specific levels for each individual in each CpG site/gene (i.e. a tensor of CpG sites/genes by individuals by cell types).
Usage
tensor(
X,
W,
C1,
C2,
Unico.mdl,
parallel = TRUE,
num_cores = NULL,
log_file = "Unico.log",
verbose = FALSE,
debug = FALSE
)
Arguments
X |
An |
W |
An |
C1 |
An |
C2 |
An |
Unico.mdl |
The entire set of model parameters estimated by Unico on the 2D mixture matrix (i.e. the list returned by applying function |
parallel |
A logical value indicating whether to use parallel computing (possible when using a multi-core machine). |
num_cores |
A numeric value indicating the number of cores to use (activated only if |
log_file |
A path to an output log file. Note that if the file |
verbose |
A logical value indicating whether to print logs. |
debug |
A logical value indicating whether to set the logger to a more detailed debug level; set |
Details
After obtaining all the estimated parameters in the Unico model (by calling Unico), tensor
uses the conditional distribution Z_{jh}^i|X_{ij}=x_{ij}
for estimating the k
source-specific levels of each sample i
at each feature j
.
Value
A k
by m
by n
array with the estimated source-specific values. The first axis/dimension in the array corresponds to the different sources.
Examples
data = simulate_data(n=100, m=2, k=3, p1=1, p2=1, taus_std=0, log_file=NULL)
res = list()
res$params.hat = Unico(data$X, data$W, data$C1, data$C2, parallel=FALSE, log_file=NULL)
res$Z = tensor(data$X, data$W, data$C1, data$C2, res$params.hat, parallel=FALSE, log_file=NULL)