logLikNB: Log likelihood for Negative Binomial

Description Usage Arguments Value Examples

View source: R/logLikes.R

Description

This is a simple function to be passed to apeglm as a log likelihood for the negative binomial distribution.

Usage

1
logLikNB(y, x, beta, param, offset)

Arguments

y

the counts

x

a design matrix

beta

the coefficient vector (natural log scale)

param

the overdispersion (alpha in DESeq2 notation)

offset

an offset matrix (natural log scale)

Value

the log likelihood for each sample in y

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# this function is used by 'apeglm' to specify
# a negative binomial log likelihood.
# so it's only passed as an argument, not for use on its own.
# we can show its output nevertheless:

y <- rnbinom(10, mu=100, size=1/.1)
x <- cbind(rep(1,10),rep(0:1,each=5))
beta <- c(log(100),0)
param <- .1
offset <- rep(0, 10)
logLikNB(y, x, beta, param, offset)

apeglm documentation built on Nov. 8, 2020, 5:55 p.m.