logLik function

log-likelihood

log-likelihood

to.logLik returns either the log-likehood function depending on a vector theta for a given sample X or the value of the log-likelihood, if eval = TRUE.

to.logLik(X, hac, eval = FALSE, margins = NULL, sum.log = TRUE, na.rm = FALSE, ...)

Arguments

  • X: a data matrix. The number of columns and the corresponding names have to coincide with the specifications of the copula model hac. The sample X has to contain at least 22 rows (observations), as the values of the underlying density cannot be computed otherwise.
  • hac: an object of the class hac.
  • eval: boolean. If eval = FALSE, the non-evaluated log-likelihood function depending on a parameter vector theta is returned and one default argument, the density, is returned. The values of theta are increasingly ordered.
  • margins: specifies the margins. The data matrix X is assumed to contain the values of the marginal distributions by default, i.e. margins = NULL. If raw data are used, the margins can be determined nonparametrically, "edf", or in parametric way, e.g. "norm". See estimate.copula for a detailed explanation.
  • sum.log: boolean. If sum.log = FALSE, the values of the individual log-likelihood contributions are returned.
  • na.rm: boolean. If na.rm = TRUE, missing values, NA, contained in X are removed.
  • ...: arguments to be passed to na.omit.

See Also

dHAC

Examples

# construct a hac-model tree = list(list("X1", "X5", 3), list("X2", "X3", "X4", 4), 2) model = hac(type = 1, tree = tree) # sample from copula model sample = rHAC(1000, model) # check the accurancy of the estimation procedure ll = to.logLik(sample, model) ll.value = to.logLik(sample, model, eval = TRUE) ll(c(2, 3, 4)) == ll.value # [1] TRUE