dlog: Calculates the percentage variation of a time series.

Description Usage Arguments Details Value See Also Examples

View source: R/dlog.R

Description

Generates series of the percentage variation of the series data passed as parameter.

Usage

1
dlog(data, lag = 1)

Arguments

data

Time series or vector to be converted to a ts object.

lag

(Optional) Number of lags to differentiate with diff(). Defaults to 1.

Details

Data must be time indexed, either as ts or zoo. If observation(s) are negative or zero, the algorithm changes to the traditional percentage variation.

Value

Time series of the percentage variation with the first position(s) as NA.

See Also

tsVarToIndex

Examples

1
2
3
4
5
6
CPI <- ts( rnorm(10,mean=100) )
Inflation <- dlCPI <- dlog( CPI )  # choose your naming convention!

x <- ts( seq(-.3,.6,.1) )
dlx <- dlog( x ) # switch algorithm to avoid generating NAs 
dl2x <- dlog( x, lag=2 ) 

fcbarbi/macroR documentation built on May 14, 2017, 12:14 a.m.