dcats_betabin: A beta-binomial regression test with similarity based...

View source: R/dcats_betabin.R

dcats_betabinR Documentation

A beta-binomial regression test with similarity based bootstrapping

Description

A GLM test with binomial distribution. In order to estimate the variance of the weight, a boostrapping based on the composition similarity is performed.

Usage

dcats_betabin(
  counts1,
  counts2,
  similarity_mat = NULL,
  n_samples = 50,
  pseudo_count = NULL
)

Arguments

counts1

A matrix of compsition sizes (n_rep1, n_cluster) for each replicate in each cluster for codition 1 as case

counts2

A matrix of compsition sizes (n_rep2, n_cluster) for each replicate in each cluster for codition 2 as control

similarity_mat

A matrix of floats (n_cluster, n_cluster) for the similarity matrix between cluster group pair. The order of cluster should be consistent with those in 'counts1' and 'counts2'

n_samples

An integer for number samples in sampling for estimating the variance of the weights

pseudo_count

A pseudo count to add for counts in all cell types. Default NULL means 0 except if a cell type is emplty in one condition, otherwise pseudo_count will be: 0.01 * rowMeans for each condition

Value

a vector of significance p values for each cluster

Examples

K <- 2
totals1 = c(100, 800, 1300, 600)
totals2 = c(250, 700, 1100)
diri_s1 = rep(1, K) * 20
diri_s2 = rep(1, K) * 20
simil_mat = create_simMat(K, confuse_rate=0.2)
sim_dat <- DCATS::simulator_base(totals1, totals2, diri_s1, diri_s2, simil_mat)
#dcats_betabin(sim_dat[[1]], sim_dat[[2]], simil_mat, n_samples = 100)


huangyh09/DCATS documentation built on Nov. 25, 2022, 7:02 a.m.