Learn R Programming

GMCM (version 1.4)

dgmcm.loglik: Probability, density, and likelihood functions of the Gaussian mixture (copula) model

Description

Marginal and simultaneous cumulative distribution, log probability density, and log-likelihood functions of the Gaussian mixture model (GMM) and Gaussian mixture copula model (GMCM) and the relevant inverse marginal quantile functions.

Usage

dgmcm.loglik(theta, u, marginal.loglik = FALSE, ...)

dgmm.loglik(theta, z, marginal.loglik = FALSE)

dgmm.loglik.marginal(theta, x, marginal.loglik = TRUE)

pgmm.marginal(z, theta)

qgmm.marginal(u, theta, res = 1000, spread = 5, rule = 2)

Arguments

theta

A list parameters as described in rtheta.

u

A matrix of (estimates of) realizations from the GMCM where each row corresponds to an observation.

marginal.loglik

Logical. If TRUE, the marginal log-likelihood functions for each multivariate observation (i.e. the log densities) are returned. In other words, if TRUE the sum of the marginal likelihoods is not computed.

Arguments passed to qgmm.marginal.

z

A matrix of realizations from the latent process where each row corresponds to an observation.

x

A matrix where each row corresponds to an observation.

res

The resolution at which the inversion of qgmm.marginal is done. Default is 1000.

spread

The number of marginal standard deviations from the marginal means the pgmm.marginal is to be evaluated on.

rule

The extrapolation rule used in approxfun.

Value

The returned value depends on the value of marginal.loglik. If TRUE, the non-summed marginal likelihood values are returned. If FALSE, the scalar sum log-likelihood is returned.

dgmcm.loglik: As above, with the GMCM density.

dgmm.loglik: As above, with the GMM density.

dgmm.loglik.marginal: As above, where the j'th element is evaluated in the j'th marginal GMM density.

pgmm.marginal: A matrix where the (i,j)'th entry is the (i,j)'th entry of z evaluated in the jth marginal GMM density.

qgmm.marginal: A matrix where the (i,j)'th entry is the (i,j)'th entry of u evaluated in the inverse jth marginal GMM density.

Details

qgmm.marginal distributes approximately res points around the cluster centers according to the mixture proportions in theta$pie and evaluates pgmm.marginal on these points. An approximate inverse of pgmm.marginal function is constructed by linear interpolation of the flipped evaluated coordinates.

Examples

Run this code
# NOT RUN {
set.seed(1)
data <- SimulateGMCMData(n = 10)
u <- data$u
z <- data$z
print(theta <- data$theta)

GMCM:::dgmcm.loglik(theta, u, marginal.loglik = FALSE)
GMCM:::dgmcm.loglik(theta, u, marginal.loglik = TRUE)

GMCM:::dgmm.loglik(theta, z, marginal.loglik = FALSE)
GMCM:::dgmm.loglik(theta, z, marginal.loglik = TRUE)

GMCM:::dgmm.loglik.marginal(theta, z, marginal.loglik = FALSE)
GMCM:::dgmm.loglik.marginal(theta, z, marginal.loglik = TRUE)

GMCM:::pgmm.marginal(z, theta)
GMCM:::qgmm.marginal(u, theta)
# }

Run the code above in your browser using DataLab