varma

Syntax

varma(ds,endogColNames,order,[exog],[trend='c'],[errorCovType='unstructured'],[measurementError=false],[enforceStationarity=true],[enforceInvertibility=true],[trendOffset=1], [maxIter=50])

Details

varma analyzes multivariate time series using a Vector Autoregressive Moving-Average (VARMA) model. It returns a dictionary containing the analysis results.

Return value: A dictionary containing the following keys:

  • params: A floating matrix of estimated parameters for the VARMA model.
  • kAr: An integer representing the order of the vector autoregressive process.
  • kMa: An integer representing the order of the vector moving average part.
  • kTrend: An integer representing the number of trend terms in the VARMA model.
  • nobs: An integer representing the number of observations in the input multivariate time series.
  • aic: A floating-point number representing the Akaike Information Criterion.
  • bic: A floating-point number representing the Bayesian Information Criterion.
  • hqic: A floating-point number representing the Hannan-Quinn Information Criterion.
  • llf: A floating-point number representing the log-likelihood value of the VARMA model.

Arguments

  • ds is an in-memory table or a vector of DATASOURCE type containing the multivariate time series to be analyzed. ds cannot be empty.
  • endogColNames is a STRING vector indicating the column names of the endogenous variables in ds.
  • order is a vector with two non-negative integers indicating the number of autoregressive (AR) and moving average (MA) parameters to use.
  • exog (optional) is a numeric matrix representing exogenous variables except the endogenous time series. Each column of the matrix represents the time series data of an exogenous variable, and the number of rows must equal the number of rows in ds.
  • trend (optional) is a string indicating the constant and trend order used in the regression. Possible values:
    • 'c' (default) - add constant
    • 'ct' - constant and treand
    • 'ctt' - constant, linear, and quadratic trend
    • 'n' - no constant or trend
  • errorCovType (optional) is a string scalar specifying the structure of the error term's covariance matrix. Possible values:
    • 'unstructured' (default): Preserve the lower triangular part of the covariance matrix
    • 'diagonal': Preserve only the diagonal part
  • measurementError (optional) is a boolean scalar indicating whether to assume the endogenous observations were measured with error. Default is false.
  • enforceStationarity (optional) is a boolean scalar indicating whether to transform AR parameters to enforce stationarity in the autoregressive component of the model. Default is true.
  • enforceInvertibility (optional) is a boolean scalar indicating whether to transform MA parameters to enforce invertibility in the moving average component of the model. Default is true.
  • trendOffset (optional) is a positive representing the offset at which time trend values start. Default is 1.
  • maxIter (optional) is a positive integer indicating the maximum number of iterations during fitting. Default is 50.

Examples

Analyze the multivariate time series in the macrodata.csv file:

data = loadText("macrodata.csv")
my_exog = matrix(DOUBLE, size(data), 1,,1)
timer result = vectorARMA(data, [`realgdp, `realcons, `realinv],[1,1],trend="c", exog=my_exog)
print(result.params)

/* Output:
params->[0.001790301048949,0.00316068649919,-0.007884084373724,-0.338899906387031,0.755151620289276,0.058664894089324,-0.133085850042808,0.327149514373616,0.042496018394458,-2.208341476722053,4.608021740892838,0.302452516000534,0.05672697191516,-0.069554114113286,-0.024169851951263,0.030727418751981,-0.05657124857038,-0.015977698360683,0.249792312785792,-0.171657789522291,-0.075503308800943,0.001790301048949,0.00316068649919,-0.007884084373724,0.007688385840775,0.003912860123486,0.005144416435363,0.030336928784212,-0.016066382781189,0.020321167196668]
llf->1974.199777819503424
kAr->1
kMa->1
kTrend->1
nobs->202
aic->-3888.399555639006848
bic->-3789.151524716970925
hqic->-3848.243622757993762
*/