Displaying 1 result from an estimated 1 matches for "subheston".
2011 Aug 26
3
How to vectorize a function to handle two vectors
...a^2 * log( (1 - g*exp(-(d*t)))/(1 - g)
) );
return(exp(C*theta + D*v0));
}
}
Price_call <- function(phi, k, t)
{
integrand <- function(u){Re(exp(-1i*u*k)*phi(u - 1i/2, t)/(u^2 + 1/4))};
res <- 1 - exp(k/2)/pi*integrate(integrand,lower=0,upper=Inf)$value;
return(res);
}
subHeston <- c(0.6067,-0.7571,0.2928,0.0707,0.0654);
kV <- c(0.9,1,1.2,1.3)
tV <- c(0.1,0.4,0.5, 1)
HestonCallVec <- function(phi, kVec, t)
{
sapply(kVec, function(k){Price_call(phi, k, t)})
}
HestonCallVec(phiHeston(subHeston), kV, 1)
subHeston <- c(0.6067,-0.7571,0.2928,0.0707,0.0654);
kV...