Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: times
See also: diff

Quantlet: tdiff
Description: calculates the d'th difference of the time series x. Furthermore, it allows to calculate the s'th seasonal difference. In terms of the backshift (or lag) operator B, the series y_t = (1-B^s)^d x_t is generated. The default values are s=1 and d=1, which generate the first differences of the series x.

Usage: y = tdiff(x, {s, d})
Input:
x T x 1 vector of observed time series
s (optional) integer; the order of the seasonal backshift operator B, default value is 1
d (optional) integer; the order of the difference operator (that is (1-B^s)), default value is 1
Output:
y (T-s*d) x 1 vector that contains the series y_t = (1-B^s)^d x_t

Example:
library("times")             ; loads the quantlets from times library
dax     = read("dax.dat")    ; monthly DAX 1979:1-2000:10
returnm = tdiff(log(dax))    ; generates the monthly return
returny = tdiff(log(dax),12) ; generates the yearly return
returnm[12]|returny[1]       ; output vector

Result:
Contents of _tmp

[1,]  0.012398
[2,] -0.1408

The monthly return of the DAX for January 1980 can be found
in the first row. The yearly return of the DAX for
January 1980 is in the second row.



Author: R. Chen, C. Hafner, R. Schulz 20021120 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006