RelativeDifference: Relative Difference

View source: R/RelativeDifference.R

RelativeDifferenceR Documentation

Relative Difference

Description

Calculates the difference between positive x and y values

Usage

RelativeDifference(X, Y, epsilon = 10^-10,

na.rm=FALSE,Silent=FALSE)

Arguments

X

either a value or numerical vector of [1:n]

Y

either a value or numerical vector of [1:n]

epsilon

Optional, If both x and y are approximatly zero the output is also zero

na.rm

Optional, function does not work with non finite values. If these cases should be automatically removed, set parameter TRUE

Silent

Optional, if TRUE message abput values below epsilon is not given back

Details

Contrary to other approaches in this cases the range of values lies between [-2,2]. The approach is only valid for positive values ofX and Y. The realtive difference R is defined with

R=\frac{Y-X}{0.5*(X+Y)}

Negative value indicate that X is higher than Y and positive values that X is lower than Y.

Value

R

Note

It can be combined with the GabrielClassificationError if a clear baseline is defined.

Author(s)

Michael Thrun

References

Ultsch, A.: Is Log Ratio a Good Value for Measuring Return in Stock Investments? GfKl 2008, pp, 505-511, 2008.

See Also

GabrielClassificationError

Examples

x=c(1:5)
y=runif(5,min=1,max=10)
RelativeDifference(x,y)

Mthrun/DatabionicSwarm documentation built on Nov. 2, 2023, 6:51 a.m.