Skip to contents

Compute the negative log-likelihood, using one or several specified distributions. The distributions have to be specified by their commonly known abbreviation in R, e.g. one of ['gamma', 'vm', 'pois', 'binom',...]. The named list of parameters (one value for each parameter and for each state) have to be in suitable form, i.e. a vector of the working parameters. In the likelihood computation, contemporaneous independence is assumed. Includes an optional penalization term \(\lambda\) for parameter selection of \(p\).

Usage

mllk(
  theta.star,
  dists,
  x,
  N,
  p_auto,
  lambda = 0,
  scale_kappa = 1,
  zero_inf = FALSE,
  alt_data = NULL
)

Arguments

theta.star

Vector of parameters in the following order: 1) Off-diagonal entries of TPM, 2) Distribution parameters for each state (each distribution at a time, i.e. first all parameters of dist1, then all parameters of dist2 etc.), 3) Autoregression parameters (each distribution at a time, i.e. first all autoregression parameters of dist1, then all autocorrelation parameters of dist2 etc.) -> degree parameters for each state of each variable.

dists

Vector containing abbreviated names (in R-jargon) of the distributions to be considered in the likelihood computation.

x

List of Data vectors or matrices for which the negative log-likelihood should be computed. Each list element corresponds to one time-series. All time-series are pooled with complete pooling.

N

Number of states.

p_auto

Vector of autoregression degrees, one value for each state of each variable (in case of penalization choose upper bound of number of parameters).

lambda

Complexity penalty (≥0) for autoregression parameters \(\phi\).(default: 0 no penalization).

scale_kappa

Default 1, Scaling factor for kappa to avoid numerical issues in optimization for large kappa.

zero_inf

Default FALSE, indicates if the gamma distributed variables should incorporate zero-inflation.

alt_data

Default NULL, provide data here if variable name x is already taken in wrapper function.

Value

Negative (penalized) log-likelihood.