FUNCTION REFERENCE
lagmatrix
Create lagged and led columns of time series data.
Create lagged and led columns of time series data.
Syntax
[YLag,TLag] = lagmatrix(Y,lags)Each row of Y is an observation and each column a series. Positive shifts are lags; negative shifts are leads. Output columns contain all input series shifted by lags(1), followed by all series shifted by lags(2), and so on. Unknown values are NaN. TLag is the original column time base (1:size(Y,1))'.
Example
[Y,t]=lagmatrix([1 -1;2 -2;3 -3],[1 0 -1])Differences from MATLAB: numeric 2-D inputs and default Shape='same' only; table/timetable, Y0, YF, Shape and DataVariables options are explicitly unsupported. At most 2048 shifts and 2000000 output elements.
Reference: https://www.mathworks.com/help/econ/lagmatrix.html
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.