R 提取密度函数(风险中性)

R 提取密度函数(风险中性),r,R,我用R来计算隐含在期权价格中的风险中性概率。我正在使用函数“extract.shimko.density”(“RND”包),但在执行该函数时出现以下错误: Error in uniroot(f, lower = lower, upper = upper, maxiter = 5000) : f() values at end points not of opposite sign 此外: Warning messages: 1: In if (is.na(f.lower)) stop("f.

我用R来计算隐含在期权价格中的风险中性概率。我正在使用函数“extract.shimko.density”(“RND”包),但在执行该函数时出现以下错误:

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

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. 

有人能帮忙吗?

请发布一个包含输入数据的示例,这样我们就可以运行代码并重现您遇到的错误。这将使帮助您变得更容易。我似乎很清楚…@MrFlick-以下是示例数据的详细信息:可以在合同月份找到的示例数据为“te”,结算为“s0”,履约价格为“k”。除call.price为call.price=price.bsm.option的call.price外,其余所需变量均为常量(r=r,te=te,s0=s0,k=k,sigma=sigma,y=y)$call.我得到了“uniroot”错误(如我在第一篇文章中提到的)当我尝试在RND包中运行“extract.shimko.density”或“compute.implicated.volatility”之类的函数时。当我在循环中执行函数时会出现错误。这些函数会出现错误:compute.implicated.volatility(r=r,te=te,s0=s0,k=k,y=y,call.price=call.price,lower=lower,upper=upper)对于extract.shimko.density(market.calls=call.price,call.strikes=k,r=r,y=y,te=te,s0=s0,lower=-10,upper=10),我不知道如何处理单根错误。