Have a Question?
Phone: +1 (888) 427-9486
+1 (312) 324-0367
Fax: +1 (312) 238-9092
Contact Us
DIFF
Returns an array of cells for the differenced time series.
Syntax
DIFF(X, Order, K)
X
is the univariate time series data (a one dimensional array of cells (e.g. rows or columns)).
Order
is the time order in the data series (i.e. whether the first data point corresponds to the earliest or latest date (earliest date=1 (default), latest date=0)).
| Order | Description |
|---|---|
| 1 | ascending (the first data point corresponds to the earliest date) (default) |
| 0 | descending (the first data point corresponds to the latest date) |
K
is the lag order (e.g. k=0 (no lag), k=1 (1st lag), etc.). If missing, the default value of one is assumed.
Remarks
- The time series is homogeneous or equally spaced.
- The time series may include missing values (e.g. #N/A) at either end.
-
The lag order (i.e. k) must be non-negative and smaller than the time series size.
- The size of the differenced time series is equal to the input time series, but with the first k observations (or last, if the original series is reversed) set to missing (i.e. #N/A).
- The differenced time series is:
![\[ \left[y_t\right]=(1-L^k)\left[x_t\right]=\left[x_t\right] -\left[x_{t-k}\right] \]](/sites/all/files/tex/1750f484ef67dfd3fb537ade9a3b518a944f4050.png)
Where:
-
is the difference time series.
-
is the input time series.
-
is the lag operatori.
-
is the lag order.
-
Examples
Example 1:
| A | B | C | |
|---|---|---|---|
| 1 | Date | Data | |
| 2 | January 10, 2008 | -0.30 | #N/A |
| 3 | January 11, 2008 | -1.28 | -0.98 |
| 4 | January 12, 2008 | 0.24 | 1.52 |
| 5 | January 13, 2008 | 1.28 | 1.04 |
| 6 | January 14, 2008 | 1.20 | -0.08 |
| 7 | January 15, 2008 | 1.73 | 0.53 |
| 8 | January 16, 2008 | -2.18 | -3.91 |
| 9 | January 17, 2008 | -0.23 | 1.95 |
| 10 | January 18, 2008 | 1.10 | 1.33 |
| 11 | January 19, 2008 | -1.09 | -2.19 |
| 12 | January 20, 2008 | -0.69 | 0.40 |
| 13 | January 21, 2008 | -1.69 | -1.00 |
| 14 | January 22, 2008 | -1.85 | -0.16 |
| 15 | January 23, 2008 | -0.98 | 0.87 |
| 16 | January 24, 2008 | -0.77 | 0.21 |
| 17 | January 25, 2008 | -0.30 | 0.47 |
| 18 | January 26, 2008 | -1.28 | -0.98 |
| 19 | January 27, 2008 | 0.24 | 1.52 |
| 20 | January 28, 2008 | 1.28 | 1.04 |
| 21 | January 29, 2008 | 1.20 | -0.08 |
| 22 | January 30, 2008 | 1.73 | 0.53 |
| 23 | January 31, 2008 | -2.18 | -3.91 |
| 24 | February 1, 2008 | -0.23 | 1.95 |
| 25 | February 2, 2008 | 1.10 | 1.33 |
| 26 | February 3, 2008 | -1.09 | -2.19 |
| 27 | February 4, 2008 | -0.69 | 0.40 |
| 28 | February 5, 2008 | -1.69 | -1.00 |
| 29 | February 6, 2008 | -1.85 | -0.16 |
| 30 | February 7, 2008 | -0.98 | 0.87 |
References
- Hamilton, J .D.; Time Series Analysis
, Princeton University Press (1994), ISBN 0-691-04289-6 - Tsay, Ruey S.; Analysis of Financial Time Series
John Wiley & SONS. (2005), ISBN 0-471-690740
