elevate: Elevate

Description Usage Arguments Details Examples

View source: R/b_data.R

Description

A transformation to turn negative prices into positive prices and maintain at the same time the hierachy between all prices.

Usage

1
elevate(X, e = NULL)

Arguments

X

The prices.

e

numeric. The focal point of the hyperbola.

Details

Negative prices in financial markets, like interest rates in Europe, are a nightmare as the rough calculation of the returns generates non-sense values. elevate uses an hyperbola and implements the following formula:

elevate(x, e) = (x + sqrt(x*x + e*e)) / 2

There is currently no rule of thumb to calculate e. When e = NULL, there is no change and the output is identical to the input. When e = 0, all negative values are turned to 0.

Examples

1
2
3
4
5
6
7
8
9
   
require(graphics)

X <- (-50:100)/5
plot( X, elevate(X, e = 5), type = "l", ylim = c(0, 20) )
lines(X, elevate(X, e = 2),   col = 2)
lines(X, elevate(X, e = 1),   col = 3)
lines(X, elevate(X, e = 0.5), col = 4)
lines(X, elevate(X, e = 0),   col = 1)

FatTailsR documentation built on March 12, 2021, 9:06 a.m.

Related to elevate in FatTailsR...