# Compute Vega and Delta in R

I am trying to compute greeks for a large sample of CEO compensation contracts in R. However, my vega computations all result in a value of zero.

In doing so, I follow Core and Guay : Here is some a snapshot of one contract that contains multiple options:

library(tidyverse)
df <- tibble(prccf = rep(36.55, 15),
Xc = 28:42,
maturity = seq(0.5, 7.5, by = (1/2)),
rf = rnorm(15, 4.5, 0.25),
d = rep(0.025, 15),
sigma = rep(0.30, 15))


I compute Z:

df <- df %>%
mutate(Zc = (log(prccf / Xc) + maturity * (rf - d + sigma^2 / 2)) / (sigma * sqrt(maturity)))


Then I take the first derivative of the Black-Scholes option value, with respect to prccf and sigma:

deriv(~ ((prccf * exp(-d * maturity) * pnorm(Zc)) - (Xc * exp(-rf * maturity) * pnorm(Zc - sigma * sqrt(maturity)))), c("prccf", "sigma"))


which gives:

delta = exp(-d * maturity) * pnorm(Zc)
vega = Xc * exp(-rf * maturity) * (dnorm(Zc - sigma * sqrt(maturity)) * sqrt(maturity))


So:

df <- df %>%
mutate(delta = exp(-d * maturity) * pnorm(Zc),
vega = Xc * exp(-rf * maturity) * (dnorm(Zc - sigma * sqrt(maturity)) * sqrt(maturity)))


But then all values for vega are zero. This happens irrespective of the parameters.

The vega part becomes zero when it gets multiplied with the normal density function: dnorm(Zc - sigma * sqrt(maturity)), because Zc contains relatively high values for the normal distribution, so it results in 0. Then the whole line gets multiplied by 0, resulting in 0s as final values as well.

I do not really see how I can fix this, since Zc does capture the right value. (The "delta code" is correct, because I can compare it to another dataset (correlation of 0.999).)

This also happens when I rely on packages instead of manually computing it, e.g.:

library(derivmkts)

bsopt(s = df$$prccf, k = df$$Xc,
v = df$$sigma, r = df$$rf,
tt = df$$maturity, d = df$$d)[['Call']][c('Delta', 'Vega'), ]


Can someome help me with this issue? I got stuck, especially because the delta part is correct. Thanks!

Are you sure your rf values are right? If 15 is to mean 15%, then write it as 0.15.
• That's it. I guess after many hours of coding such a tiny mistake becomes invisible.. rf = rnorm(15, 4.5, 0.25) should indeed be rf = rnorm(15, 0.045, 0.0025). Thanks! Sep 21, 2019 at 12:55