2222from arch .univariate .volatility import ConstantVariance , GARCH , HARCH , ARCH , \
2323 RiskMetrics2006 , EWMAVariance , EGARCH , FixedVariance
2424from arch .univariate .distribution import Normal , StudentsT
25+
2526try :
2627 import matplotlib .pyplot # noqa
28+
2729 HAS_MATPLOTLIB = True
2830except ImportError :
2931 HAS_MATPLOTLIB = False
@@ -715,7 +717,7 @@ def test_fixed_user_parameters_new_model(self):
715717 am = arch_model (self .y_series )
716718 res = am .fit (disp = DISPLAY )
717719 new_am = arch_model (self .y_series )
718- fixed_res = new_am .fix (res .params )
720+ fixed_res = new_am .fix (res .params )
719721 assert_series_equal (res .conditional_volatility ,
720722 fixed_res .conditional_volatility )
721723 assert_series_equal (res .params , fixed_res .params )
@@ -728,7 +730,7 @@ def test_fixed_user_parameters_new_model(self):
728730 am = arch_model (self .y_series )
729731 res = am .fit (disp = DISPLAY , first_obs = 100 , last_obs = 900 )
730732 new_am = arch_model (self .y_series )
731- fixed_res = new_am .fix (res .params , first_obs = 100 , last_obs = 900 )
733+ fixed_res = new_am .fix (res .params , first_obs = 100 , last_obs = 900 )
732734 assert_series_equal (res .params , fixed_res .params )
733735 assert_equal (res .aic , fixed_res .aic )
734736 assert_equal (res .bic , fixed_res .bic )
@@ -868,3 +870,16 @@ def test_constant_mean_fixed_variance(self):
868870 res = mod .fit ()
869871 assert len (res .params ) == 4
870872 assert 'scale' not in res .params .index
873+
874+ def test_optimization_options (self ):
875+ am = arch_model (None )
876+ data = am .simulate ([0.0 , 0.1 , 0.1 , 0.85 ], 2500 )
877+ am = arch_model (data .data )
878+ std = am .fit (disp = 'off' )
879+ loose = am .fit (tol = 1e-2 , disp = 'off' )
880+ assert std .loglikelihood != loose .loglikelihood
881+ with warnings .catch_warnings (record = True ) as w :
882+ short = am .fit (options = {'maxiter' : 3 }, disp = 'off' )
883+ assert len (w ) == 1
884+ assert std .loglikelihood != short .loglikelihood
885+ assert short .convergence_flag != 0
0 commit comments