tcGmmPen: Fit Two-Condition Gaussian Mixture Model with Penalization

Description Usage Arguments Value Author(s) Examples

View source: R/tcGmmPen.R

Description

This function fits the Two-Condition Gaussian Mixture Model (TCGMM) with penalty. We assume that the latent groups are consistent between two conditions only with shifts in mean parameters.

This function fits the Two-Condition Gaussian Mixture Model (TCGMM). We assume that the latent groups are consistent between two conditions only with shifts in mean parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
tcGmmPen(
  y,
  g,
  zInit,
  maxIter = 100,
  thresh = 1e-16,
  lambda = 1,
  verboseN = TRUE,
  type.prop = NULL
)

Arguments

y

A matrix with rows as samples (cells) and columns as features (genes)

g

A vector indicating condition 1 (0) and condition 2 (1)

zInit

A matrix indicating the assignment of groups with rows as samples and columns as groups

maxIter

A numeric value of maximum iteration number. Default is 100.

thresh

A numeric value of the converge criteria. Define as the Frobenius norm of the difference of current mean and mean in last iteration. Default is 1e-8.

verboseN

A logical value. Whether to print the iteration number.

type.prop

A numeric vector specifying fixed type proportions. Default is NULL.

Value

A list with the components:

mu

The mean parameter

sigma

The standard deviation parameter

delta

The shift of mean parameter

z

The assignment of groups

model

The fitted regression model of each group

Author(s)

Dongyuan Song

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(extraDistr)
mu1 <- c(5, 7, 9)
theta1 <- c(1, 2, 0)
sigma1 <- c(1, 2, 3)
mu2 <- c(10, 15, 4)
theta2 <- c(1, 2, 6)
sigma2 <- c(0.4, 0.2, 0.4)
mu.mat <- cbind(mu1, mu2)
delta.mat <- cbind(theta1, theta2)
sigma.mat <- cbind(sigma1, sigma2)
dat <- simGen(n = 100, n.feature = 2, n.group = 3, type.prop = c(0.2, 0.3, 0.5),
mu.mat = mu.mat, sigma.mat = sigma.mat, delta.mat = delta.mat)
p_int <- c(0.4, 0.3, 0.3)
z_int <- rmnom(n = 100, size = 1, prob = p_int)
fit <- tcGmmPen(dat$y, dat$g, zInit = z_int)

SONGDONGYUAN1994/tcgmm documentation built on July 31, 2020, 9:18 p.m.