Displaying 2 results from an estimated 2 matches for "implvol".
2011 Aug 18
3
Error message: object of type 'closure' is not subsettable
Dear R-users
I need to calibrate kappa, rho, eta, theta, v0 in the following code, see
below. However when I run it, I get:
y <- function(kappahat, rhohat, etahat, thetahat, v0hat) {sum(difference(k,
t, S0, X, r, implvol, q, kappahat, rhohat, etahat, thetahat, v0hat)^2)}
> nlminb(start=list(kappa, rho, eta, theta, v0), objective = y, lower =lb,
> upper =ub)
Error in dots[[1L]][[1L]] : object of type 'closure' is not subsettable
And I don't know what this mean and what I am doing wrong. Can anyone...
2011 Aug 16
2
Calibrating the risk free interest rate using nlminb
...Here is my data:
http://r.789695.n4.nabble.com/file/n3747509/S%26P_500_calls%2C_jan-jun_2010.csv
S%26P_500_calls%2C_jan-jun_2010.csv
S0 <- 1136.03
q <- 0.02145608
S0 <- spot[10,6]
S0
strike <- marketdata[1:460,9]
T <- marketdata[1:460,17]/365 #Notice the T is measured in years now
implvol <- marketdata[1:460,12]
ask <- marketdata[1:460,10]
bid <- marketdata[1:460,11]
mid_bidask <- (bid + ask) /2
r <- 0.020
And my code:
BS_Call <- function(S0, K, T, r, sigma, q) # Which works
fine
{
sig <- sigma * sqrt(T)
d1 <- (log (S0/K) + (r - q + sigma^...