Displaying 3 results from an estimated 3 matches for "presentvalu".
Did you mean:
presentvalue
2011 Aug 16
2
Calibrating the risk free interest rate using nlminb
...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^2/2) * T ) / sig
d2 <- d1 - sig
Presentvalue <- exp(-r*T)
return (S0 * exp(-q*T) * pnorm(d1) - K*Presentvalue*pnorm(d2))
}
#I now define the function I later want to minimize with respect to r
difference <- function (S0, K, T, r, sigma, q, mid)
{
return(BS_Call(S0, strike, T, r, sigma, q)- mid_bidask))
}
# which gives 460 valu...
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]] :
2013 Jun 05
0
R error- "more columns than column names"
I put header=TRUE and sep = “;” and my problem was resolved.
read.csv("./scoreDb.csv",header = TRUE,sep=";"
Best Regards,
Sandro
[[alternative HTML version deleted]]