[R] optim function multi variables -newbie

Hans W Borchers hwborchers at googlemail.com
Thu Jan 27 18:05:08 CET 2011


michalseneca <michalseneca <at> gmail.com> writes:

> Hi,
> Basically what I am trying is to rewrite matlab code into R ...This is code
> for famous SABR model Calibration.
> I did most of the code up to optimalization issue.
> In the attachment you can find matlab and my unfinished R code..This is very
> helpful code...Basically I am trying to achieve the same results.
> 
> Thank you very much for your help..This might help me much with my thesis
> 
> Best regards 
> Michal 

Apparently, you are resetting the input 'params' within the function
EstimateRhoAndVol() to c(0.5, 0.5) regardless of what the actual input is.
No wonder that 'optim' returns the starting values: it sees a constant
function.

Besides that, you have to be more careful with NAs in the SABR model.
Did you try out the function? --- Are you testing the list?

--Hans Werner



More information about the R-help mailing list