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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.