http://quantlib.414.s1.nabble.com/Re-Question-regarding-EndCriteria-parameter-Old-Subject-Garch11-exmaple-code-needed-tp18435.html
Hi,
Ok, I've progressed and I'm willing to share my code here for anyone else who is having difficulties.
This is the main method of my class:
int CGarch::GarchOnArray(const std::vector<double> &iPrices, std::vector<double> &oGarch)
{
if (iPrices.empty()) {
QL_FAIL("ERROR: input array (ts) is empty");
return -1;
}
if(iPrices.size < 3) {
QL_FAIL("ERROR: minimum (3) individual prices not present in ts array");
return -1;
}
oGarch.clear();
Date ds(7, July, 1962);
TimeSeries<Volatility> ts(ds, iPrices.begin(), iPrices.end());
Garch11 g11(ts, Garch11::MomentMatchingGuess);
LevenbergMarquardt lm;
g11.calibrate(ts, lm, EndCriteria(3, 2, 0.0, 0.0, 0.0));
g11.calibrate(ts);
TimeSeries<Volatility> tsOut = g11.calculate(ts);
tsOut.find(ds+ts.size()+1);
oGarch = tsOut.values();
return 0;
}
However, I still don't understand the EndCriteria part of the code and haven't been able to find any answers in the available documentation.
I'd appreciate if someone could help me explain what each parameter does.
maxIterations_
Maximum number of iterations.
Are these iterations through the TimeSeries data or future iterations of how many results will be returned.
maxStationaryStateIterations_
Maximun number of iterations in stationary state.
What is the meaning of stationary state.
rootEpsilon_
root, function and gradient epsilons
I assume this is the value from which the process starts searching.
functionEpsilon_
What's this?
gradientNormEpsilon_
What's this?
I appreciate this all probably related to Levenberg-Marquardt algorithm but I'm not a maths expert and haven't done stochastic calculus so struggling a little bit with this.
Really appreciate any help.
Thanks in advance.