Learn R Programming

ecostate (version 0.2.0)

ddirmult: Dirichlet-multinomial

Description

Allows data-weighting as parameter

Usage

ddirmult(x, prob, ln_theta, log = TRUE)

Value

The log-likelihood resulting from the Dirichlet-multinomial distribution

Arguments

x

numeric vector of observations across categories

prob

numeric vector of category probabilities

ln_theta

logit-ratio of effective and input sample size

log

whether to return the log-probability or not

Examples

Run this code
library(RTMB)
prob = rep(0.1,10)
x = rmultinom( n=1, prob=prob, size=20 )[,1]
f = function( ln_theta ) ddirmult(x, prob, ln_theta)
f( 0 )
F = MakeTape(f, 0)
F$jacfun()(0)

Run the code above in your browser using DataLab