MATLAB Answers

fmincon options settings mrsgarch

8 views (last 30 days)
Deegan Huisman
Deegan Huisman on 28 May 2021
Answered: Alan Weiss on 28 May 2021
Hi everyone,
I have been using the code from Marcucci (2005) on MRSGARCH models, but I keep getting an error in the garchestfor_con_all.m file.
This code works on matlab version up to 2010, but im using 2016b. I know that the this code needs to be changed, but I cant figure out how to do this without causing any errors further in the fmincon function.
options = optimset(options , 'TolFun' , 1e-6);
options = optimset(options , 'TolX' , 1e-6);
options = optimset(options , 'TolCon' , 1e-6);
options = optimset(options , 'Display' , 'iter');
options = optimset(options , 'Diagnostics' , 'on');
options = optimset(options , 'LargeScale' , 'off');
options = optimset(options , 'MaxIter' , 2500);
options = optimset(options , 'HessUpdate' ,'bfgs');
ERROR HERE options = optimset(options, 'levenberg-marquardt', 'off');
ERROR HERE: options = optimset(options , 'LineSearchType' ,'cubicpoly');
options = optimset(options , 'Jacobian' ,'off');
options = optimset(options , 'MeritFunction' ,'multiobj');
options = optimset(options, 'MaxFunEvals' , 1000);
I have tried the following lines for the levenberg-marquardt line:
  • options = optimoptions(@fsolve,'Algorithm','levenberg-marquardt','InitDamping',0.1);
However, because I used optimoptions now instead of optimset the options variable couldn't be changed again by optimset
  • options = optimset(options, 'Algorithm', 'levenberg-marquardt', 'Jacobian', 'off');
With this line I received an error further down the code in the fmincon function: 'Invalid choice of option Algorithm for FMINCON. Choose 'sqp', 'interior-point', 'trust-region-reflective', or 'active-set'.
For the LineSearchType line, I haven't been able to find a solution.
FMINCON function:
[parameters, LL(j,1)] = fmincon('garchlik', x0 ,A, b, [],[],lowerBounds, upperBounds, [], options, data, errortype, garchtype, constr, flag1);
How can I rewrite this code, such that the fmincon function still runs properly?
Thanks in advance!

Accepted Answer

Alan Weiss
Alan Weiss on 28 May 2021
Here are some options you can try (some of your values do not make sense, such as having MaxIter be greater than MaxFunEvals, or specifying HessUpdate):
options = optimoptions('fmincon',...
'MaxFunctionEvaluations',5e3,...
'MaxIterations',3e3,...
'Algorithm','interior-point',...
'Display','iter',...
'Diagnostics','on')
options =
fmincon options: Options used by current Algorithm ('interior-point'): (Other available algorithms: 'active-set', 'sqp', 'sqp-legacy', 'trust-region-reflective') Set properties: Algorithm: 'interior-point' Display: 'iter' MaxFunctionEvaluations: 5000 MaxIterations: 3000 Default properties: BarrierParamUpdate: 'monotone' CheckGradients: 0 ConstraintTolerance: 1.0000e-06 FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' HessianApproximation: 'bfgs' HessianFcn: [] HessianMultiplyFcn: [] HonorBounds: 1 ObjectiveLimit: -1.0000e+20 OptimalityTolerance: 1.0000e-06 OutputFcn: [] PlotFcn: [] ScaleProblem: 0 SpecifyConstraintGradient: 0 SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-10 SubproblemAlgorithm: 'factorization' TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('interior-point')
You could also try these similar options for the 'sqp' algorithm:
options = optimoptions('fmincon',...
'MaxFunctionEvaluations',5e3,...
'MaxIterations',3e3,...
'Algorithm','sqp',...
'Display','iter',...
'Diagnostics','on')
options =
fmincon options: Options used by current Algorithm ('sqp'): (Other available algorithms: 'active-set', 'interior-point', 'sqp-legacy', 'trust-region-reflective') Set properties: Algorithm: 'sqp' Display: 'iter' MaxFunctionEvaluations: 5000 MaxIterations: 3000 Default properties: CheckGradients: 0 ConstraintTolerance: 1.0000e-06 FiniteDifferenceStepSize: 'sqrt(eps)' FiniteDifferenceType: 'forward' ObjectiveLimit: -1.0000e+20 OptimalityTolerance: 1.0000e-06 OutputFcn: [] PlotFcn: [] ScaleProblem: 0 SpecifyConstraintGradient: 0 SpecifyObjectiveGradient: 0 StepTolerance: 1.0000e-06 TypicalX: 'ones(numberOfVariables,1)' UseParallel: 0 Show options not used by current Algorithm ('sqp')
For details, see fmincon options.
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by