0

Im using R to calculate the risk neutral probability implicit in option prices. Im using function 'extract.shimko.density' ("RND" package), but getting the following error when I execute the function:

Error in uniroot(f, lower = lower, upper = upper, maxiter = 5000) :
f() values at end points not of opposite sign 

In addition:

Warning messages: 1: In if (is.na(f.lower)) stop("f.lower = f(lower) is NA") :   
the condition has length > 1 and only the first element will be used 2: 
In if (is.na(f.upper)) stop("f.upper = f(upper) is NA") :   
the condition has length > 1 and only the first element will be used. 

Can someone please help?

Mike Wise
  • 22,131
  • 8
  • 81
  • 104
  • 1
    Please post a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input data so we can run the code and reproduce the error you are getting. That will make it much easier to help you. – MrFlick Dec 21 '15 at 18:28
  • Seems pretty clear to me... – Mike Wise Dec 21 '15 at 18:31
  • @MrFlick - below are details of a sample data: Sample data can be found at http://www.cmegroup.com/market-data/datamine-historical-data/files/e-mini%20s%26p%20options%2010-01-2012.csv – financeglory Dec 22 '15 at 19:45
  • Contract month is 'te', Settlement is 's0' and strike price is 'k'.Rest of the required variables are constants except call.price which is call.price = price.bsm.option(r=r, te=te, s0=s0, k=k, sigma = sigma, y = y)$call. Im getting the 'uniroot' error (as mentioned in my first post) when I attempt to run functions like 'extract.shimko.density' or 'compute.implied.volatility' in the RND package. The error appears when I execute the function in a loop. – financeglory Dec 22 '15 at 19:58
  • The error appears for these functions: compute.implied.volatility(r=r, te=te, s0=s0, k=k, y=y, call.price=call.price, lower=lower, upper=upper) and also for extract.shimko.density(market.calls=call.price,call.strikes=k,r=r,y=y,te=te,s0=s0,lower=-10,upper=10). I can't figure out how to deal with the uniroot error. – financeglory Dec 22 '15 at 20:01
  • Would be really great if someone could help! – financeglory Dec 23 '15 at 04:29

0 Answers0