logLikNB {apeglm} | R Documentation

## Log likelihood for Negative Binomial

### Description

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

### Usage

    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

    # 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)

[Package apeglm version 1.16.0 Index]