DIconvex {DIconvex} R Documentation

## 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 x have to be positive and ranked in ascending order. The vector x can not contain duplicate data. lower a numeric vector of the same length as x containing the lower limit points. The elements of the vector lower have to be non-negative and finite. upper a numeric vector of the same length as x containing the upper limit points. The elements of the vector upper have to be non-negative and finite. Furthermore, L_i\le U_i, i=1,\ldots,n. 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, y_{i+1}-y_{i}\le (\ge)epsim, \, i=1,\ldots,n-1. The default value is 0. epsic a positive value controlling the convexity condition. For \alpha_i:=(x_i-x_{i+1})/(x_{i-1}-x_{i+1}) the condition imposed is y_i- \alpha _i y_{i+1}-(1-\alpha_i)y_{i-1}\le epsic, \, i=2,\ldots,n-1. The default value is 0. 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 i \notin C. The default value is TRUE.

### 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)

[Package DIconvex version 1.0.0 Index]