lnD: Log Difference of a Time Series

Description Usage Arguments Value Examples

View source: R/ts_lag_ops.R

Description

lnD calculates the log-difference of an 'xts' time series.

Usage

1
lnD(x, lag = 1, diff = 1)

Arguments

x

'xts' time series variable

lag

numeric or character value indicating the number of periods to lag x. Defaults to one lag. Character inputs indicate the type of time period to lag. lag accepts 'y' years, 'q' quarters, 'm' months, 'w' weeks, and 'd' days. Number and character values can be combined.

diff

number of times the x is differenced

Value

log-differenced 'xts' object.

Examples

1
2
3
4
5
Y <- pwt(country = 'USA', series = 'gdp')
d_Y <- lnD(Y)           # GDP differenced by 1 period (quarter)
y_Y <- lnD(Y, 'y')      # GDP differenced by 1 year
D_Y <- lnD(Y, diff = 2) # GDP differenced twice
#Table(Y, d_y, y_Y, D_Y)

cmann3/recon documentation built on May 13, 2019, 8:23 p.m.