Previous Page | Next Page

Language Reference

DIF Function

DIF( x <, lags> ) ;

The DIF function computes the differences between data values and one or more lagged (shifted) values for time series data. The arguments are as follows:

x

specifies a numerical matrix of time series data.

lags

specifies integer lags. The lags argument can be an integer matrix with elements. If so, the DIF function returns an matrix where the th column represents the difference between the time series and the lagged data for the th lag.

The values of the lags argument are usually positive integers. A positive lag shifts the time series data backwards in time. A lag of 0 represents the original time series. A negative value for the lags argument shifts the time series data forward in time; this is sometimes called a lead effect.

For example, the following statements compute the difference between the time series and the lagged data:

x = {1,3,4,7,9};
dif = dif(x, {0 1 3});
print dif;

Figure 23.84 Differences between Data and Lagged Data
dif
0 . .
0 2 .
0 1 .
0 3 6
0 2 6

Previous Page | Next Page | Top of Page