Learn R Programming

gctsc (version 0.1.3)

pmvn_tmet: TMET Log-Likelihood Approximation

Description

Computes the approximate log-likelihood for a count time series model using the Time Series Minimax Exponential Tilting (TMET) method. This function uses the autoregressive movin average structure of the underlying Gaussian copula to compute multivariate normal rectangle probabilities via adaptive importance sampling with an optimal tilting parameter.

Usage

pmvn_tmet(lower, upper, tau, od, pm = 30, 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.

pm

Integer. Number of past lags used for approximating ARMA(p,q) to AR (required if q > 0).

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.

Details

The implementation combines the Innovations Algorithm for exact conditional mean and variance computation with exponential tilting to estimate the multivariate normal probability over rectangular truncation sets.

Examples

Run this code
# Simulate Poisson AR(1) data
sim_data <- sim_poisson(mu =10, tau=0.2, arma_order=c(1,0), nsim = 1000, seed = 1)
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_tmet(lower = a, upper = b, tau = 0.2, od = c(1,0))
print(llk_tmet)

Run the code above in your browser using DataLab