Title: | Finding Patterns of Monotonicity and Convexity in Data |
---|---|
Description: | Given an initial set of points, this package minimizes the number of elements to discard from this set such that there exists at least one monotonic and convex mapping within pre-specified upper and lower bounds. |
Authors: | Paul Schneider [aut, ths], Liudmila Karagyaur [aut] |
Maintainer: | Liudmila Karagyaur <[email protected]> |
License: | GPL-2 |
Version: | 1.0.0 |
Built: | 2024-11-26 06:24:07 UTC |
Source: | CRAN |
This package takes as input x values , as well as lower
, and upper bounds
. It maximizes
such that there exists at least one convex increasing (decreasing) set of values
, where
is the set of indices
for which
.
DIconvex(x, lower, upper, increasing = FALSE, epsim = 0, epsic = 0,visual=TRUE)
DIconvex(x, lower, upper, increasing = FALSE, epsim = 0, epsic = 0,visual=TRUE)
x |
a numeric vector containing a set of points. The elements of |
lower |
a numeric vector of the same length as |
upper |
a numeric vector of the same length as |
increasing |
a boolean value determining whether to look for an increasing or decreasing pattern. The default value is FALSE. |
epsim |
a non-negative value controlling the monotonicity conditions, |
epsic |
a positive value controlling the convexity condition. For |
visual |
a boolean value indicating whether a visual representation of the solution is desired. Here a solution is depicted for all values of x, with linearly interpolated y if |
The package DIconvex
is solved as a linear program facilitating lpSolveAPI
.
It lends itself to applications with financial options data. Given a dataset of call or put options, the function maximizes the number of data points such that there exists at least one set of arbitrage-free fundamental option prices within bid and ask spreads.
For this particular application, x
is the vector of strike prices, lower
represents the vector of bid prices and upper
represents the vector of ask prices.
a list containing:
a vector containing .
a vector containing .
a single integer value containing the status code of the underlying linear program. For the interpretation of status codes please see lpSolveAPI
R documentation. The value 0 signifies success.
Liudmila Karagyaur <[email protected]>
Paul Schneider <[email protected]>
x = c(315, 320, 325, 330, 335, 340, 345, 350) upper = c(0.5029714, 0.5633280, 0.6840411, 0.8751702, 3.0000000, 1.5692708, 2.3237279, 3.5207998) lower = c(0.2514857, 0.4325554, 0.4325554, 0.6236845, 2.5000000, 1.1870125, 1.9414696, 3.1385415) DIconvex(x, lower, upper, increasing = TRUE) x = c(340, 345, 350, 355, 360, 365) lower = c(2.7661994, 1.3177168, 1.5029454, 0.1207069, 0.1207069, 0.1207069) upper = c(3.1383790, 1.5088361, 1.6236522, 0.3721796, 0.1810603, 0.2514727) DIconvex(x, lower, upper, increasing = FALSE)
x = c(315, 320, 325, 330, 335, 340, 345, 350) upper = c(0.5029714, 0.5633280, 0.6840411, 0.8751702, 3.0000000, 1.5692708, 2.3237279, 3.5207998) lower = c(0.2514857, 0.4325554, 0.4325554, 0.6236845, 2.5000000, 1.1870125, 1.9414696, 3.1385415) DIconvex(x, lower, upper, increasing = TRUE) x = c(340, 345, 350, 355, 360, 365) lower = c(2.7661994, 1.3177168, 1.5029454, 0.1207069, 0.1207069, 0.1207069) upper = c(3.1383790, 1.5088361, 1.6236522, 0.3721796, 0.1810603, 0.2514727) DIconvex(x, lower, upper, increasing = FALSE)