getAffinity: Calculate responsibilities.

Description Usage Arguments Value Author(s) Examples

View source: R/mnems.r

Description

This function calculates the responsibilities of each component for all cells from the expected log distribution of the hidden data.

Usage

1
2
3
4
5
6
7
8
9
getAffinity(
  x,
  affinity = 0,
  norm = TRUE,
  logtype = 2,
  mw = NULL,
  data = matrix(0, 2, ncol(x)),
  complete = FALSE
)

Arguments

x

log odds for l cells and k components as a kxl matrix

affinity

0 for standard soft clustering, 1 for hard clustering during inference (not recommended)

norm

if TRUE normalises to probabilities (recommended)

logtype

logarithm type of the data (e.g. 2 for log2 data or exp(1) for natural)

mw

mixture weights of the components

data

data in log odds

complete

if TRUE, complete data log likelihood is considered (for very large data sets, e.g. 1000 cells and 1000 E-genes)

Value

responsibilities as a kxl matrix (k components, l cells)

Author(s)

Martin Pirkl

Examples

1
2
3
4
5
sim <- simData(Sgenes = 3, Egenes = 2, Nems = 2, mw = c(0.4,0.6))
data <- (sim$data - 0.5)/0.5
data <- data + rnorm(length(data), 0, 1)
result <- mnem(data, k = 2, starts = 1)
resp <- getAffinity(result$probs, mw = result$mw, data = data)

Example output

Registered S3 methods overwritten by 'RcppEigen':
  method               from         
  predict.fastLm       RcppArmadillo
  print.fastLm         RcppArmadillo
  summary.fastLm       RcppArmadillo
  print.summary.fastLm RcppArmadillo

mnem documentation built on Nov. 18, 2020, 2 a.m.