Learn R Programming

gmvarkit (version 1.1.1)

loglikelihood_int: Compute the log-likelihood of Gaussian Mixture Vector Autoregressive model

Description

loglikelihood_int computes the log-likelihood of GMVAR model.

Usage

loglikelihood_int(data, p, M, params, conditional = TRUE,
  parametrization = c("intercept", "mean"), constraints = NULL,
  to_return = c("loglik", "mw", "mw_tplus1", "loglik_and_mw", "terms",
  "regime_cmeans", "total_cmeans", "total_ccovs"), check_params = TRUE,
  minval = NULL)

Arguments

data

a matrix or class 'ts' object with d>1 columns. Each column is taken to represent a single time series. NA values are not supported.

p

a positive integer specifying the autoregressive order of the model.

M

a positive integer specifying the number of mixture components.

params

a real valued vector specifying the parameter values.

For regular models:

Should be size \(((M(pd^2+d+d(d+1)/2+1)-1)x1)\) and have form \(\theta\)\( = \)(\(\upsilon\)\(_{1}\), ...,\(\upsilon\)\(_{M}\), \(\alpha_{1},...,\alpha_{M-1}\)), where:

  • \(\upsilon\)\(_{m}\) \( = (\phi_{m,0},\)\(\phi\)\(_{m}\)\(,\sigma_{m})\)

  • \(\phi\)\(_{m}\)\( = (vec(A_{m,1}),...,vec(A_{m,p})\)

  • and \(\sigma_{m} = vech(\Omega_{m})\), m=1,...,M.

For constrained models:

Should be size \(((M(d+d(d+1)/2+1)+q-1)x1)\) and have form \(\theta\)\( = (\phi_{1,0},...,\phi_{M,0},\)\(\psi\) \(,\sigma_{1},...,\sigma_{M},\alpha_{1},...,\alpha_{M-1})\), where:

  • \(\psi\) \((qx1)\) satisfies (\(\phi\)\(_{1}\)\(,...,\) \(\phi\)\(_{M}) =\) \(C \psi\). Here \(C\) is \((Mpd^2xq)\) constraint matrix.

Above \(\phi_{m,0}\) is the intercept parameter, \(A_{m,i}\) denotes the \(i\):th coefficient matrix of the \(m\):th mixture component, \(\Omega_{m}\) denotes the error term covariance matrix of the \(m\):th mixture component and \(\alpha_{m}\) is the mixing weight parameter. If parametrization=="mean", just replace each \(\phi_{m,0}\) with regimewise mean \(\mu_{m}\). \(vec()\) is vectorization operator that stacks columns of a given matrix into a vector. \(vech()\) stacks columns of a given matrix from the principal diagonal downwards (including elements on the diagonal) into a vector. The notations are in line with the cited article by Kalliovirta, Meitz and Saikkonen (2016).

conditional

a logical argument specifying whether the conditional or exact log-likelihood function should be used. Default is TRUE.

parametrization

"mean" or "intercept" determining whether the model is parametrized with regime means \(\mu_{m}\) or intercept parameters \(\phi_{m,0}\), m=1,...,M. Default is "intercept".

constraints

a size \((Mpd^2 x q)\) constraint matrix \(C\) specifying general linear constraints to the autoregressive parameters. We consider constraints of form (\(\phi\)\(_{1}\)\(,...,\)\(\phi\)\(_{M}) = \)\(C \psi\), where \(\phi\)\(_{m}\)\( = (vec(A_{m,1}),...,vec(A_{m,p}) (pd^2 x 1), m=1,...,M\) contains the coefficient matrices and \(\psi\) \((q x 1)\) contains the constrained parameters. For example, to restrict the AR-parameters to be the same for all regimes, set \(C\)= [I:...:I]' \((Mpd^2 x pd^2)\) where I = diag(p*d^2). Ignore (or set to NULL) if linear constraints should not be employed.

to_return

should the returned object be log-likelihood value, mixing weights, mixing weights including value for \(alpha_{m,T+1}\), a list containing log-likelihood value and mixing weights or the terms \(l_{t}: t=1,..,T\) in the log-likelihood function (see KMS 2016, eq.(9))? Or should the regimewise conditional means, total conditional means, or total conditional covariance matrices be returned? Default is the log-likelihood value ("loglik").

check_params

should it be checked that the parameter vector satisfies the model assumptions? Can be skipped to save computation time if it does for sure. Default TRUE.

minval

value that will be returned if the parameter vector does not lie in the parameter space (excluding the identification condition).

Value

By default:

log-likelihood value of the specified GMVAR model,

If to_return=="mw":

a size ((n_obs-p)xM) matrix containing the mixing weights: for m:th component in m:th column.

If to_return=="mw_tplus1":

a size ((n_obs-p+1)xM) matrix containing the mixing weights: for m:th component in m:th column. The last row is for \(\alpha_{m,T+1}\)

.
If to_return=="terms":

a size ((n_obs-p)x1) numeric vector containing the terms \(l_{t}\).

if to_return=="loglik_and_mw":

a list of two elements. The first element contains the log-likelihood value and the second element contains the mixing weights.

If to_return=="regime_cmeans":

an [T-p, d, M] array containing the regimewise conditional means (the first p values are used as the initial values).

If to_return=="total_cmeans":

a [T-p, d] matrix containing the conditional means of the process (the first p values are used as the initial values).

If to_return=="total_ccov":

an [d, d, T-p] array containing the conditional covariance matrices of the process (the first p values are used as the initial values).

Details

Takes use of the function dmvn from the package mvnfast to cut down computation time. Values extremely close to zero are handled with the package Brobdingnag.

References

  • Kalliovirta L., Meitz M. and Saikkonen P. 2016. Gaussian mixture vector autoregression. Journal of Econometrics, 192, 485-498.

  • Lutkepohl H. 2005. New Introduction to Multiple Time Series Analysis, Springer.