I am trying to fit equity option implied vols using SVI model in Java, and I am using apache math commons library. Some of the option expiries fit very well, but others are completely off, and I am having difficulty to figure out why. Wanted to post here to see if someone can help.
I am using the raw svi model, and fitting one expiry at a time.
Within apache commons math, I have implemented the SVI function as a ParametricUnivariateFunction. I am not sure if I should be using this or the MultiVariateFunction
Then for curve fitting, I have implemented the AbstractCurveFitter in which I use the LeastSquareBuilder.
The apache commons math library is not very well documented. So is there a better numerical Java or Scala library that I can use instead?
Within the commons math library, there are classes for optimization, curve fitting, and Least Square. All of them seem to be somewhat similar. Which one of these is most suitable for a problem like this ?