Hi,
I am new in this mailing list and don't know exactly if this issue was already discussed: I am currently trying to calibrate the G2 model, which has the 5 parameters (a, sigma, b, eta, rho), to caps and swaptions using the Simplex optimizer. Within the optimization somthing happens like: newParams = params + delta*direction if (!test(newParams)) { // decrease delta and repeat test until test is passed // if (toomanyiterations) throw Error("Could not adjust parameter"); } I found that the test was never passed although the parameters newParams seemed to have reasonable values that should comply to the constraints a>0, sigma>0, b>0, eta>0, -1<rho<+1. Debugging further, I found that the PositiveConstraint for the first parameter is applied to _all_ 5 parameters instead only to the first one. Therefore I suppose that the following code in model.hpp is incorrect: class Model::PrivateConstraint : public Optimization::Constraint { . . . bool test(const Array& params) const { Size k=0; for (Size i=0; i<arguments_.size(); i++) { Size size = arguments_[i].size(); Array testParams(size); for (Size j=0; j<size; j++, k++) testParams[j] = params[k]; if (!arguments_[i].testParams(params)) return false; } return true; } and should be replaced by the version below: bool test(const Array& params) const { Size k=0; for (Size i=0; i<arguments_.size(); i++) { Size size = arguments_[i].size(); Array testParams(size); for (Size j=0; j<size; j++, k++) testParams[j] = params[k]; if (!arguments_[i].testParams(testParams)) return false; } return true; } Otherwise the array testParams, which is constructed for the actual parameter, would have no further use in this routine. The bug would imply that in all short-rate models the constraint of the first parameter is applied to all parameter. Could you please tell me if I am wrong or wheter the (maybe) bug is already fixed in some release or in the CVS tree. Best regards Götz Rienäcker Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. This message is confidential and may be privileged. If you are not the intended recipient, we kindly ask you to inform the sender. Any unauthorised dissemination or copying hereof is prohibited. This message serves for information purposes only and shall not have any legally binding effect. Given that e-mails can easily be subject to manipulation, we can not accept any liability for the content provided. |
Free forum by Nabble | Edit this page |