Type: | Package |
Title: | Finding Patterns of Monotonicity and Convexity in Data |
Version: | 1.0.0 |
Author: | Paul Schneider [aut, ths], Liudmila Karagyaur [aut] |
Maintainer: | Liudmila Karagyaur <liudmila.karagyaur@usi.ch> |
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. |
Depends: | lpSolveAPI |
License: | GPL-2 |
NeedsCompilation: | no |
Packaged: | 2018-09-14 14:17:08 UTC; paultschi |
Repository: | CRAN |
Date/Publication: | 2018-09-20 18:00:15 UTC |
Finding patterns of monotonicity and convexity in two-dimensional data
Description
This package takes as input x values x_1,\ldots,x_n
, as well as lower L_1,\ldots,L_n
, and upper bounds U_1,\ldots,U_n
. It maximizes \sum _{i=1}^{n}f_i, \, f_i\in \{0,1\}
such that there exists at least one convex increasing (decreasing) set of values L_j\le y_j\le U_j, j\in C
, where C
is the set of indices i=1,\ldots,n
for which f_i=1
.
Usage
DIconvex(x, lower, upper, increasing = FALSE, epsim = 0, epsic = 0,visual=TRUE)
Arguments
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 |
Details
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.
Value
a list containing:
a vector containing f_1,\ldots,f_n
.
a vector containing y_j, \, j \in C
.
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.
Author(s)
Liudmila Karagyaur <liudmila.karagyaur@usi.ch>
Paul Schneider <paul.schneider@usi.ch>
Examples
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)