TemporalRelativeDifference: Temporal Relative Difference

View source: R/TemporalRelativeDifference.R

TemporalRelativeDifferenceR Documentation

Temporal Relative Difference

Description

Calculates the relative difference between positive Data and and lagged Data

Usage

TemporalRelativeDifference(Data,Lag=1,

na.rm=FALSE,PlotIt=FALSE,Time,Silent=FALSE)

Arguments

Data

numerical matrix of [1:n,1:d], d>=1

Lag

The number of lags (in units of observations): back shifting: positiv value,forward shifting: negative value, default is the difference to yesterday

na.rm

FALSE; do nothing, TRUE: all nan to zero

PlotIt

TRUE: plots data

Time

[1:n] vector defining time and used for plotting, typically as.Date object

Silent

TRUE: not warnings or messages

Details

Contrary to linear filters in this cases the range of values lies always between [-2,2]

If vector is given as input, vector is given back. If matrix is given as input, PlotIt is forced to be set as FALSE.

Value

Reldiff numerical matrix of [1:n,1:d]. For example for Lag=1: negative value indicate that today is lower than yesterday and positive values that todays value is higher than yesterdays.

Author(s)

Michael thruh

See Also

RelativeDifferenceBetweenTS

Examples

data(ElectricityBRD$Mrd_KWh)
V=TemporalRelativeDifference(ElectricityBRD$Mrd_KWh,
PlotIt=TRUE,Time=(ElectricityBRD$Time))

V=TemporalRelativeDifference(cbind(ElectricityBRD$Mrd_KWh,
ElectricityBRD$Mrd_KWh))

Mthrun/TSAT documentation built on Feb. 5, 2024, 11:15 p.m.