GARCH Toolbox |
 |
lagmatrix
Create a lagged time series matrix
Syntax
Arguments
X
|
Time series of explanatory data. X can be a vector or a matrix. As a vector (row or column), X represents a univariate time series whose first element contains the oldest observation and whose last element contains the most recent observation. As a matrix, X represents a multivariate time series whose rows correspond to time indices in which the first row contains the oldest observations and the last row contains the most recent observations. lagmatrix assumes that observations across any given row occur at the same time. Each column is an individual time series.
|
Lags
|
Vector of integer lags. lagmatrix applies the first lag to every series in X , then applies the second lag to every series in X , and so forth. To include a time series as is, include a 0 lag. Positive lags correspond to delays, and shift a series back in time. Negative lags correspond to leads, and shift a series forward in time.
|
Description
XLAG = lagmatrix(X, Lags)
creates a lagged (i.e., shifted) version of a time series matrix. The lagmatrix
function is useful for creating a regression matrix of explanatory variables for fitting the conditional mean of a return series.
XLAG
|
Lagged transform of the time series X . To create XLAG , lagmatrix shifts each time series in X by the first lag, then shifts each time series in X by the second lag, and so forth. Since XLAG represents an explanatory regression matrix, each column is an individual time series. XLAG has the same number of rows as there are observations in X , but its column dimension is equal to the product of the number of columns in X and the length of Lags . lagmatrix uses a NaN (Not-a-Number) to indicate an undefined observation.
|
Example
The following example creates a bivariate time series matrix X
with five observations each, then creates a lagged matrix XLAG
composed of X
and the first two lags of X
. The result, XLAG,
is a 5-by-6 matrix.
See Also
filter
, isnan
, and nan
(in the online MATLAB Function Reference)
| garchsim | | lbqtest |  |