DIconvex: Finding patterns of monotonicity and convexity in...

Description Usage Arguments Details Value Author(s) Examples

View source: R/DIconvex.R

Description

This package takes as input x values x_1,…,x_n, as well as lower L_1,…,L_n, and upper bounds U_1,…,U_n. It maximizes ∑ _{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≤ y_j≤ U_j, j\in C, where C is the set of indices i=1,…,n for which f_i=1.

Usage

1
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≤ U_i, i=1,…,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}≤ (≥)epsim, \, i=1,…,n-1. The default value is 0.

epsic

a positive value controlling the convexity condition. For α_i:=(x_i-x_{i+1})/(x_{i-1}-x_{i+1}) the condition imposed is y_i- α _i y_{i+1}-(1-α_i)y_{i-1}≤ epsic, \, i=2,…,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,…,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 <[email protected]>

Paul Schneider <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

DIconvex documentation built on Sept. 21, 2018, 6:28 p.m.