getNBGaussianLikelihood: Calculate the log likelihood of observed read counts

View source: R/MAUDE.R

getNBGaussianLikelihoodR Documentation

Calculate the log likelihood of observed read counts

Description

Uses a normal distribution (N(mu,sigma)) to estimate how many reads are expected per bin under nullModel, and calculates the log likelihood under a negative binomial model. This function is usually not used directly.

Usage

getNBGaussianLikelihood(x, mu, k, sigma = 1, nullModel, libFract)

Arguments

x

a vector of guide counts per bin

mu

the mean for the normal expression distribution

k

the vector of total counts per bin

sigma

for the normal expression distribution (defaults to 1)

nullModel

the bin bounds for the null model (for no change in expression)

libFract

the fraction of the unsorted library this guide comprises (e.g. from unsorted cells, or sequencing the vector)

Value

the log likelihood

Examples

#usually not used directly
#make a bin sorting model with 6 10% bins
curSortBins = makeBinModel(data.frame(Bin = c("A","B","C","D","E","F"), fraction = rep(0.1,6)))
readsForGuideX =c(10,20,30,100,200,100); #the reads for this guide
getNBGaussianLikelihood(x=readsForGuideX, mu=1, k=rep(1E6,6), sigma=1, nullModel=curSortBins, 
  libFract = 50/1E6)
getNBGaussianLikelihood(x=readsForGuideX, mu=-1, k=rep(1E6,6), sigma=1, nullModel=curSortBins, 
  libFract = 50/1E6)
#mu=1 is far more likely (closer to 0) than mu=-1 for this distribution of reads

Carldeboer/MAUDE documentation built on March 27, 2022, 8:50 p.m.