matrix_interpolation: Linear interpolation

View source: R/matrix_interpolation.R

matrix_interpolationR Documentation

Linear interpolation

Description

The matrix_interpolation function interpolate values for vector.

Usage

matrix_interpolation(Value_matrix, ds, dt, I, asset_price, time, End_Time)

Arguments

Value_matrix

numeric matrix, returns from finite different algorithm or delta_finite_difference function.

ds

numeric value, step size of the asset price.

dt

numeric value, step size of the time.

I

numeric value, number of steps in the stock price.

asset_price

numeric vector, the price of the asset over the life of the option.

time

numeric vector, actual time.

End_Time

numeric value, end time of the option.

Details

If asset price is bigger then I*ds, we take value from this element of the matrix where asset_price = I*ds.

Value

A numeric vector, interpolated value of option price or numbers of asset when asset_price is an argument.

Examples

ds <- finding_parameters(100, 0.3, 600, 5)[1]
dt <- finding_parameters(100, 0.3, 600, 5)[2]
option <- finite_difference_explicit(ds, dt, 600, 0, 0.3, 1, call_payoff, 100)
matrix_interpolation(option, ds, dt, 600, c(259, 150), c(0, 0.5), 1)


mociepa/ShortfallRiskHedging documentation built on Sept. 30, 2022, 6:43 p.m.