diffLog: Calculate the difference of log data

Description Usage Arguments Details Value Examples

Description

Calculate the difference from lag periods prior for log of data.

Usage

1
2
3
4
5
    diffLog(obj, lag=1, base = exp(1),
         names=paste("diff of log of ", seriesNames(obj)))
    ## Default S3 method:
diffLog(obj, lag=1, base = exp(1),
         names=paste("diff of log of ", seriesNames(obj)))

Arguments

obj

A time series object.

lag

The difference is calculated relative to lag periods prior.

base

Base to use when calculating logrithms.

names

names for the new series (but is details).

Details

The result is a time series of the difference relative to lag periods prior for the log of the data. lag data points are lost from the beginning of the series. Negative values will result in NAs.

The names are not applied to the new series if the global option ModSeriesNames is FALSE. This can be set with options(ModSeriesNames=FALSE). This provides a convenient mechanism to prevent changing series labels on plot axis, when the title may indicate that data is in year-to-year percent change so the axis label does not need this.

Value

A time series vector or matrix.

Examples

1
2
3
z <- matrix(100 + rnorm(200),100,2)
z[z <= 0] <- 1 # not to likely, but it can happen
z <- diffLog(z)

tfplot documentation built on May 2, 2019, 4:47 p.m.

Related to diffLog in tfplot...