Calculate the difference from lag periods prior for log of data.
Usage
diffLog(obj, lag=1, base = exp(1),
names=paste("diff of log of ", seriesNames(obj)))
# S3 method for default
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).
Value
A time series vector or matrix.
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.