ecmFit#
Purpose#
Calculate and return parameter estimates for an error correction model.
Format#
- vmo = ecmFit(y, p[, vmc])#
- vmo = ecmFit(dataset, formula, p[, vmc])
- Parameters:
y (Nx1 vector) – data.
dataset (string) – name of data set or null string.
formula (string) – formula string of the model. E.g. “y ~ X1 + X2” ‘y’ is the name of dependent variable, ‘X1’ and ‘X2’ are names of independent variables; E.g. “y ~ .” , ‘.’ means including all variables except dependent variable ‘y’;
p (scalar) – order of AR process.
vmc (struct) – Optional input, an instance of a
varmamtControl
structure. The following members of vmc are referenced within this routine:
- Returns:
vmo (struct) – An instance of a
varmamtOut
structure containing the following members:
Example#
new;
cls;
library tsmt;
// Load data
fname = getGAUSSHome("pkgs/tsmt/examples/ecmmt.csv");
y = csvReadM(fname, 1, 2);
y = vmdiffmt(y, 1);
// Declare varmamt control structure
struct varmamtControl vmc;
// Initialize control structure with default values
vmc = varmamtControlCreate;
// No contraints
vmc.setConstraints = 0;
// Set up start values
phi = { 0.05 -0.05, 0 0.01, 0.1 -0.07, 0.05 -0.04 };
vmc.start = pvcreate();
vmc.start = pvPacki(vmc.start,areshape(phi, 2|2|2), "phi", 1);
vmc.start = pvPacksi(vmc.start, xpnd(15.9521|14.2525|15.9908), "vc", 3);
// Call ecmFit
struct varmamtOut vout;
vout = ecmFit(y , 1, vmc);
Remarks#
Errors are assumed to be distributed \(N(0, Q)\).
Library#
tsmt
Source#
varmamt.src
See also
Functions varmaFit()