Learn R Programming

gctsc (version 0.1.3)

pmvn_ghk: GHK Log-Likelihood Approximation

Description

Computes the approximate log-likelihood for a count time series model using the Geweke–Hajivassiliou–Keane (GHK) simulator. This method evaluates the multivariate normal rectangle probability by sequentially sampling from truncated conditionals implied by the ARMA Gaussian copula.

Usage

pmvn_ghk(lower, upper, tau, od, M = 1000, QMC = TRUE, ret_llk = TRUE)

Value

If ret_llk = TRUE, a numeric scalar (log-likelihood); else a list containing diagnostic statistics.

Arguments

lower

A numeric vector of lower truncation bounds.

upper

A numeric vector of upper truncation bounds.

tau

A numeric vector of ARMA dependence parameters.

od

Integer vector c(p, q) specifying the AR and MA orders.

M

Integer. Number of Monte Carlo or QMC samples.

QMC

Logical. If TRUE, use quasi-Monte Carlo integration.

ret_llk

Logical. Default is TRUE to return log-likelihood; otherwise, return diagnostic output.

Examples

Run this code
# Simulate Poisson AR(1) data
mu=10
tau=0.2
arma_order=c(1,0)
sim_data <- sim_poisson(mu =mu, tau=tau, arma_order=arma_order, nsim = 1000, seed = 1)
y <- sim_data$y

# Compute latent bounds for CE method
a <- qnorm(ppois(y - 1, lambda = mu))  # lower bound
b <- qnorm(ppois(y, lambda = mu))      # upper bound
# Approximate log-likelihood with CE method
llk_tmet <- pmvn_ghk(lower = a, upper = b, tau = 0.2, od = c(1,0))
print(llk_tmet)

Run the code above in your browser using DataLab