Skip to contents

Compute the log-likelihood for multiple Binom(N,phi) observations

Usage

arch_loglike(param, y)

Arguments

param

Either a vector with two elements, N and phi, or a data.frame with two columns, named N and phi

y

a data vector

Value

The log-likelihood for each N,phi combination. The implementation internally uses the log-gamma function to provide a differentiable function of N, which allows optim() to treat N as a continuous variable. If N < max(y), the log-likelihood is defined to be -Inf.

Examples

arch_loglike(
  param = data.frame(N = c(5, 10, 20, 40),
                     phi = c(0.1, 0.2, 0.3, 0.4)),
  y = c(2, 4))
#> [1] -10.324930  -3.626867  -5.618058 -25.216655