1
$\begingroup$

I start with predefined beta and alpha. Then I want to find rho and nu so the Sum of Squared Errors is minimized. By SSE I mean the difference between my model estimated volatilities and observed maarket volatilities. How can I do it in R? I have done following:

## difvol is a function of rho and nu, which is the sum of squared errors.
nlm(difvol,0.01,0.01)

difvol is designed like that:

(first observed volatility - Black implied volatility)^2 + (second observed volatility - Black implied volatility)^2 ...

Black implied volatility has no values in my setup because I have no estimates for rho and nu.

However, the nlm code only returns one estimate and both I need to estimate nu and rho. What to do from here? How do I use nlm properly.

I know my difvol function could have been better but I don't want to change that.

$\endgroup$
  • $\begingroup$ I would say that this question belong to stackoverflow (for programming) $\endgroup$ – Sanjay Nov 18 '16 at 23:39
2
$\begingroup$

Try to redesign your object function, your difvol, so it's a function of a two dimensional vector

dilvol<-function(X){ 
rho<-X[1]
nu<-X[2]
##type in your function here and use rho and nu normally..
}
nlm(difvol,c(0.1,0.1)

This might work

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy