Name

delda — differentiates a ts ignoring NA values

CALLING SEQUENCE

tsout=delda(arg1[,arg2])

PARAMETERS

Input

• arg1 = the order of differenciation (optional, set to 1 if not provided, can be > 0, =0 or < 0) or a ts

• arg2 = a time series if the first argument was set to the order of differentiation

Output

• tsout = the differenciated time series

DESCRIPTION

Computes x(t)-x(t-n) for a timeseries x where all NA values are ignored (that is x(t-n) is the nth non NA value preceding x(t)). Equivalent, but a little bit quicker than x-lagts(n,x).

EXAMPLE

if x is a ts:
1) y = delda(x)
2) y = delda(1,x)
3) y = delda(4,x)
4) y = delda(-3,x)
 
The first 2 examples are equivalent: y is the result of the differenciation of x. The result of the third one is the ts y = x- x(-4) and the result of the fourth one is the ts = x - x(+3). Note that delda(2,x) is not the same as delda(delda(x)). 

               

AUTHOR

Eric Dubois 20007