Description Usage Arguments Details Value Author(s) References Examples
approximate.max
gives a smooth approximation to the max function.
1 | approximate.max(x, y, k = 5)
|
x |
the first argument for the max function |
y |
the second argument fot the max function |
k |
a tuning parameter. The larger this value, the closer the function output to a true max function. |
approximate.max
approximates the max of x, and y as follows:
g(x,y) = \frac{1}{1 + \exp(-k(x-y))}, \ \ \max(x,y) \approx x g(x,y) + y(1 - g(x,y))
approximate maximum of x and y
Kam Hamidieh
Melick, W. R. and Thomas, C.P. (1997) Recovering an asset's implied pdf from option proces: An application to crude oil during the gulf crisis. Journal of Financial and Quantitative Analysis, 32(1), 91-115
1 2 3 4 5 6 7 8 9 10 11 | #
# To see how the max function compares with approximate.max,
# run the following code.
#
i = seq(from = 0, to = 10, by = 0.25)
y = i - 5
max.values = pmax(0,y)
approximate.max.values = approximate.max(0,y,k=5)
matplot(i, cbind(max.values, approximate.max.values), lty = 1, type = "l",
col=c("black","red"), main = "Max in Black, Approximate Max in Red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.