public class VectorAutoregression extends Object implements Serializable, Cloneable
This class contains methods for modeling multivariate time series of the form
![]()
![]()
![]()
![]()
![]()
The vector autoregressive model, or VAR, has a number of equivalent forms. A general form is
![]()
![]()
| Constructor and Description |
|---|
VectorAutoregression(TimeSeries ts)
Constructor for the class.
|
| Modifier and Type | Method and Description |
|---|---|
double[] |
getARConstants()
Returns the current settings of the constants used in the autoregression
model.
|
int[] |
getARModel()
Returns the autoregressive model configuration.
|
double[][] |
getEstimates()
Returns the parameter estimates (coefficients) of the vector
autoregression model.
|
double[][] |
getForecasts()
Returns the h-step ahead forecast at times
t=nT, nT+1, ..., T, where
h=1,2, ...,
maxStepsAhead. |
boolean |
isA0Flag()
Returns the state of
A0Flag. |
void |
setA0Flag(boolean A0Flag)
Sets the flag to include the leading autoregressive coefficient matrix in
the model.
|
void |
setARConstants(double[] arConstants)
Sets the constants for the autoregressive model.
|
void |
setARLag(int arLag)
Sets the autoregressive lag parameter.
|
void |
setARModel(int[] arModel)
Sets the form of the autoregressive terms of the model.
|
void |
setCenter(boolean center)
Sets the flag to center the data.
|
void |
setMaxLag(int maxLag)
Sets the maximum lag.
|
void |
setScale(boolean scale)
Sets the flag to scale the data.
|
void |
setTrend(boolean trend)
Sets the flag to fit a trend parameter in the model.
|
public VectorAutoregression(TimeSeries ts)
ts - a TimeSeries object.public double[] getARConstants()
double array containing the constants used in the
autoregression model. If the value is null, the default
values are active.public int[] getARModel()
int array specifying the autoregressive
configuration. If null, then all parameters are active in
the current model.public double[][] getEstimates()
double array containing the estimated parameters
(coefficients).public double[][] getForecasts()
maxStepsAhead.
The h-step ahead forecast
![]()
![]()
double matrix T-nT by
maxStepsAhead * K containing the forecasts.
Note that the forecast
is stored in location
[t-nT][(h-1)*K + k] of the returned forecast matrix.
public boolean isA0Flag()
A0Flag.boolean which specifies whether or not the leading
coefficient matrix is nontrivial.public void setA0Flag(boolean A0Flag)
When true, a nontrivial, lower-triangular leading
autoregressive coefficient matrix, A0, will be
estimated in the model. When false, A0
is the constant identity matrix, which is also the default case.
A0Flag - boolean indicating whether to fit the leading
coefficient matrix.
Default: A0Flag=false.
public void setARConstants(double[] arConstants)
setARModel(int[]) for details.arConstants - a double array specifying the
autoregressive model constants.
The input array arConstants must be of length
(A0Flag+arLag)*K*K,
such that for indices 1=0,...,(A0Flag + arLag),
i=0,...,K-1, and
j=0,...,K-1, arConstants[l*K*K +i*K +
j] specifies a constant value for parameter
.
arConstants[i]=0.public void setARLag(int arLag)
maxLag.arLag - an int specifying the desired lag for the
autoregressive terms.
Default: arLag=1.public void setARModel(int[] arModel)
Without loss of generality, assume that the series mean is 0 and that there are no deterministic terms. Then we can write the vector autoregression model of lag p as
![]()
![]()
![]()
![]()
![]()
![]()
![]()
arModel - an int array specifying the autoregressive
model parameters.
For indices
l=0,...,(A0Flag+arLag),
i=0,...,K-1, and j=0,...,K-1,
arModel[l*K*K +i*K + j] = {-1,1}
indicates that the coefficient
is a parameter (to be estimated) in the model.
Default: A0 is the identity matrix and
arModel[i]=1 for all i.
public void setCenter(boolean center)
center=true, column means are subtracted from
the data.center - a boolean indicating whether or not column
means should be subtracted from the data.
Default: center=false.
public void setMaxLag(int maxLag)
maxLag - an int specifying the maximum lag to consider
in the first (pure VAR) stage regression.public void setScale(boolean scale)
If scale=true, the data values are
mean-centered and then divided by the standard deviation.
scale - a boolean
Default: scale=false.
public void setTrend(boolean trend)
true to include a deterministic trend in the model.trend - a boolean specifying whether or not to include
a deterministic trend.
Default: trend=false.
Copyright © 1970-2015 Rogue Wave Software
Built June 18 2015.