Name

lagda — lag a ts ignoring NA values

CALLING SEQUENCE

ts=lagda(arg1[,arg2])

PARAMETERS

Input

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

• arg2 (if arg1 was he order of differenciation) = a time series

Output

• ts = the lagged time series

DESCRIPTION

Computes x(t-n) for a timeseries x(t) where all NA values are ignored (that is x(t-n) is the nth non NA value preceding x(t)).

EXAMPLE

1) y = lagda(x)
2) y = lagda(4,x)
3) y = lagda(-1,x)
 
In example 1, y is x lagged once. 
In example 2, y is x lagged four times.
In example 3, y is x forwarded once.

               

AUTHOR

Eric Dubois 2007