diffinv
Discrete Integration: inverse of diff

Description

Provides a discrete integration for a vector, a matrix or a time series object.

Usage

diffinv(x, ...)
## Default S3 method:
diffinv(x, lag = 1, differences = 1, xi, ...) 
## S3 method for class 'ts':
diffinv(x, lag = 1, differences = 1, xi, ...)
## S3 method for class 'vector':
diffinv(x, lag = 1, differences = 1, xi, ...) 

Arguments

x a vector, a matrix, or a time series object.
lag an integer number. Specifies the lag parameter.
differences an integer number. Specifies the differences parameter.
xi a vector, matrix, or a time series object. Specifies the initial value for discrete integration. If this argument is missing, it is filled with zero. NCOL(xi) must be lag*differences.
... an additional argument to pass to or from future functions.

Details

diffinv is the inverse of the diff function. If dx is diff(x,lag,differences) then diffinv(dx,lag,differences,xi=x[seq_len(lag*differences)]) recreates the vector x.
Value
returns a vector, a matrix, or a time series object.
See Also
ts, integrate
Examples
diffinv(2 ^ -(0:6), lag = 2)
diffinv(2 ^ -(0:6), lag = 2, differences =2)
diffinv(2 ^ -(0:6), lag = 2, xi = c(1/12, 1/3))
diffinv(matrix(1:12, 3, 4), lag = 2,differences = 2, xi = matrix(rep(1,16), 4, 4))
diffinv(ts(sin(1:10), frequency=4, start=2013.25))
Package stats version 6.1.1-7
Package Index