Skip to content
Prev 169742 / 398506 Next

uniroot() problem

Thanks for this reply. Here I was trying to calculate implied volatility
using BS formula. This is my code :

oo = 384.40 # traded option price
    uu = 1563.25 # underlying price
    tt = 0.656 # time to maturity in year
    ii = 2.309/100 # interest rate, annualized
    th.price = function(x)
       {
        d1 = (log(uu/K) + (ii + x^2/2)*tt) / (x*sqrt(tt)); d2 = d1 -
x*sqrt(tt)
        option.price = uu * pnorm(d1) - K * exp(-ii*tt) * pnorm(d2)
        return(option.price - oo)
       }

uniroot(th.price, c(-20, 20), tol=1/10^12)

I got following result :
$root
[1] 6.331672e-13

$f.root
[1] 36.28816

$iter
[1] 55

$estim.prec
[1] 7.385592e-13

Hence using implied volatility, difference between traded price and
theoretical price is coming as high as 36.28816, even I increse the
precision level. Any idea how to crack this problem?
Albyn Jones wrote: