Library: | finance |
See also: | optstart greeks |
Quantlet: | influence | |
Description: | displays graphically the influence of the parameters entering the Black and Scholes formula on the option price. |
Usage: | dat=influence() or dat=influence(S,K,r,sigma,tau,carry,opt{,v1,ub1{,v2,ub2}}) | |
Input: | ||
S | price of the underlying asset. See the notes for further information about the dimension of all parameters. | |
K | exercise price | |
r | domestic interest rate which can be found in the following interval: [0%,100%] | |
sigma | volatility per year in the interval (0%,100%) | |
tau | time to expiration (in years) | |
carry | cost of carry in percent of the value of the underlying object (0%,100%) | |
opt | type of the option: 1 for call, 0 for put | |
v1 | scalar, numerical values determining the explanatory variable for a 2- or 3-dimensional plot: 1 for S, 2 for K , 3 for r, 4 for sigma, 5 for tau, 6 for carry. If not specified, no plot will be displayed. | |
ub1 | upper bound for the chosen explanatory variable v1. Lower bound is the already specified value (S,K,r,sigma,tau or carry). | |
v2 | scalar, second explanatory variable for the 3-dimensional plot. | |
ub2 | upper bound for the second explanatory variable v2. | |
Output: | ||
dat | the computed option prices at the specified points |
2) The interest rate and the cost of carry are used continuously (log(0.01*r + 1) resp. log(0.01*carry + 1) ) in the algorithm.
3) If the plot should be depicted which means that at least v1 is specified, all of the obligatory input parameters (i.e. S, K, r, sigma, tau, carry and opt) must be scalars. If the parameters v2 and ub2 are specified, a three-dimensional plot will be constructed. Option prices are computed and depicted afterwards in the interval (upper bound - lower bound), which is divided into 30 equally spaced parts. The output "dat" has two or three columns - the first column contains the values of the first specified variable v1, the second column the values of the second variable v2 (if specified) and the last one consists of the computed option prices at the specified points.
4) If only a text output is desired (v1 is not specified), the obligatory inputs can be generally (n x 1) vectors. Scalars will be expanded automatically to vectors of the length n. A (n x 8) matrix is given as output. The first seven columns of the output matrix correspond to the input variables and the last column contains the computed option prices (same applies to the quantlet blackscholes with carry=0).
library("finance") dat = influence()
Opens several interactive menus where you are asked to specify the option features and your variables of interest. According to your choice a two or three dimensional graph displays the option price as a function of the chosen variable(s).
library("finance") S = 230 ;(spot) price of the underlying K = 210 ; exercise price r = 5 ; interest rate sigma = 25 ; volatility tau = 0.5 ; days to maturity carry = 5 ; cost of carry opt = 1 ; call v1 = 1 ; spot price ub1 = 250 v2 = 4 ; volatility ub2 = 30 i2=influence(S,K,r,sigma,tau,carry,opt,v1,ub1,v2,ub2) i2[1:10]
Contents of _tmp [ 1,] 230 0.25 26.834 [ 2,] 230.67 0.25 27.308 [ 3,] 231.33 0.25 27.786 [ 4,] 232 0.25 28.268 [ 5,] 232.67 0.25 28.753 [ 6,] 233.33 0.25 29.241 [ 7,] 234 0.25 29.733 [ 8,] 234.67 0.25 30.228 [ 9,] 235.33 0.25 30.726 [10,] 236 0.25 31.227 The first column represents the prices of the underlying, the second column consists of one value only - which is the volatility of 25% (the other volatilities are contained in the following rows) and the third column contains the corresponding option prices. A three-dimensional plot, the suface of European call option prices depending on spot price and volatility, is depicted as well.
library("finance") S = aseq(150,6,10) K = aseq(150,6,15) r = 10 sigma = aseq(5,6,2) tau = 5:10 carry = 10 opt = 0|0|1|0|1|1 influence(S,K,r,sigma,tau,carry,opt)
Contents of dat [1,] 150 150 10 5 5 10 0 4.1522 [2,] 160 165 10 7 6 10 0 7.7786 [3,] 170 180 10 9 7 10 1 6.188 [4,] 180 195 10 11 8 10 0 14.665 [5,] 190 210 10 13 9 10 1 9.2967 [6,] 200 225 10 15 10 10 1 11.002