bbEstDisp {apeglm}R Documentation

Simple line-search estimator for dispersion of a beta binomial

Description

Uses R's optimize function to find the maximum likelihood estimate of dispersion for a beta binomial distribution (theta for the dbetabinom function in the emdbook package). The counts, size, and beta are matrices, such that each row could be treated as a beta-binomial GLM problem.

Usage

bbEstDisp(success, size, x, beta, minDisp, maxDisp)

Arguments

success

the observed successes (a matrix)

size

the total trials (a matrix)

x

the design matrix, as many rows as columns of success and size

beta

a matrix of MLE coefficients, as many rows as success and size

minDisp

the minimum dispersion value

maxDisp

the maximum dispersion value

Value

a vector of estimated dispersions

Examples


library(emdbook)
n <- 100
m <- 100
size <- matrix(rnbinom(n*m, mu=100, size=10),ncol=m)
success <- matrix(rbetabinom(n*m, prob=.5, size=size, theta=100),ncol=m)
x <- matrix(rep(1,m),ncol=1)
beta <- matrix(rep(0,n),ncol=1)
theta <- bbEstDisp(success, size, x, beta, 1, 500)
summary(theta)


[Package apeglm version 1.2.1 Index]