22
22
from arch .univariate .volatility import ConstantVariance , GARCH , HARCH , ARCH , \
23
23
RiskMetrics2006 , EWMAVariance , EGARCH , FixedVariance
24
24
from arch .univariate .distribution import Normal , StudentsT
25
+
25
26
try :
26
27
import matplotlib .pyplot # noqa
28
+
27
29
HAS_MATPLOTLIB = True
28
30
except ImportError :
29
31
HAS_MATPLOTLIB = False
@@ -715,7 +717,7 @@ def test_fixed_user_parameters_new_model(self):
715
717
am = arch_model (self .y_series )
716
718
res = am .fit (disp = DISPLAY )
717
719
new_am = arch_model (self .y_series )
718
- fixed_res = new_am .fix (res .params )
720
+ fixed_res = new_am .fix (res .params )
719
721
assert_series_equal (res .conditional_volatility ,
720
722
fixed_res .conditional_volatility )
721
723
assert_series_equal (res .params , fixed_res .params )
@@ -728,7 +730,7 @@ def test_fixed_user_parameters_new_model(self):
728
730
am = arch_model (self .y_series )
729
731
res = am .fit (disp = DISPLAY , first_obs = 100 , last_obs = 900 )
730
732
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 )
732
734
assert_series_equal (res .params , fixed_res .params )
733
735
assert_equal (res .aic , fixed_res .aic )
734
736
assert_equal (res .bic , fixed_res .bic )
@@ -868,3 +870,16 @@ def test_constant_mean_fixed_variance(self):
868
870
res = mod .fit ()
869
871
assert len (res .params ) == 4
870
872
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