σ
αp7]c           @` sR  d  Z  d d l m Z m Z m Z d d l Z d d l m Z m	 Z	 m
 Z
 m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d d l  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& d d l' m( Z( m) Z) m* Z* d d l+ m, Z, d e- f d	     YZ. d
 e. f d     YZ/ d S(   sΟ   
Tests for setting options in KalmanFilter, KalmanSmoother, SimulationSmoother

(does not test the filtering, smoothing, or simulation smoothing for each
option)

Author: Chad Fulton
License: Simplified-BSD
i    (   t   divisiont   absolute_importt   print_functionN(   t   FILTER_CONVENTIONALt   FILTER_EXACT_INITIALt   FILTER_AUGMENTEDt   FILTER_SQUARE_ROOTt   FILTER_UNIVARIATEt   FILTER_COLLAPSEDt   FILTER_EXTENDEDt   FILTER_UNSCENTEDt   FILTER_CONCENTRATEDt   INVERT_UNIVARIATEt   SOLVE_LUt	   INVERT_LUt   SOLVE_CHOLESKYt   INVERT_CHOLESKYt   STABILITY_FORCE_SYMMETRYt   MEMORY_STORE_ALLt   MEMORY_NO_FORECASTt   MEMORY_NO_PREDICTEDt   MEMORY_NO_FILTEREDt   MEMORY_NO_LIKELIHOODt   MEMORY_NO_GAINt   MEMORY_NO_SMOOTHINGt   MEMORY_NO_STD_FORECASTt   MEMORY_CONSERVE(   t   SMOOTHER_STATEt   SMOOTHER_STATE_COVt   SMOOTHER_STATE_AUTOCOVt   SMOOTHER_DISTURBANCEt   SMOOTHER_DISTURBANCE_COVt   SMOOTHER_ALL(   t   SimulationSmoothert   SIMULATION_STATEt   SIMULATION_ALL(   t   assert_equalt   Optionsc           B` s   e  Z e d     Z RS(   c         O` sG   t  j d  } d } t d d d | | |  |  _ |  j j |  d  S(   Ni
   i   t   k_endogt   k_states(   t   npt   arangeR!   t   modelt   bind(   t   clst   argst   kwargst   endogR'   (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   setup_class;   s
    (   t   __name__t
   __module__t   classmethodR0   (    (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyR%   :   s   t   TestOptionsc           B` s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C` s9  |  j  } d | _ t | _ t | j t  t | _ t | j t t B t | _ t | j t  | j	 t
  t | j t
  | j	 d t d t  t | j t  d | _ x! | j D] } t | | t  q· Wt | j t t Bt
 Bt Bt Bt Bt Bt Bt B x! | j D] } t | | t  qWt | j d  d  S(   Ni    t   filter_conventionalt   filter_augmented(   R*   t   filter_methodt   TrueR5   R$   R   t   filter_collapsedR   t   Falset   set_filter_methodR   t   filter_methodst   setattrR   R   R   R	   R
   R   (   t   selfR*   t   name(    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   test_filter_methodsH   s.    							'c         C` s3  |  j  } d | _ t | _ t | j t  t | _ t | j t t B t | _ t | j t  | j	 t
  t | j t
  | j	 d t d t d t  t | j t t B d | _ x! | j D] } t | | t  qΑ Wt | j t t Bt
 Bt Bt B x! | j D] } t | | t  qWt | j d  d  S(   Ni    t   invert_choleskyt   invert_univariatet	   invert_lu(   R*   t   inversion_methodR8   RB   R$   R   RA   R   R:   t   set_inversion_methodR   t   inversion_methodsR=   R   R   (   R>   R*   R?   (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   test_inversion_methodsp   s2    								c         C` sΐ   |  j  } d | _ t | _ t | j t  t | _ t | j d  d | _ | j t  t | j t  d | _ | j d t  t | j t  d | _ | j d t  t | j t  d  S(   Ni    t   stability_methodt   stability_force_symmetry(   R*   RH   R8   RI   R$   R   R:   t   set_stability_method(   R>   R*   (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   test_stability_methods   s    							c         C` se  |  j  } t | _ t | _ t | j t  t | _ t | j t t B t	 | _ t | j t  | j
 t  t | j t  | j
 d t d t	  t | j t  d | _ x3 | j D]( } | d k rΟ q· n  t | | t  q· Wt | j t t Bt Bt Bt Bt Bt B t | j t  x3 | j D]( } | d k r=q%n  t | | t	  q%Wt | j d  d  S(   Nt   memory_no_filteredt   memory_no_predictedi    t   memory_conserve(   R*   R   t   conserve_memoryR8   t   memory_no_forecastR$   R   RL   R   R:   t   set_conserve_memoryR   t   memory_optionsR=   R   R   R   R   R   (   R>   R*   R?   (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   test_conserve_memory±   s:    							c         C` s]  |  j  } d | _ t | _ t | j t  t | _ t | j t t B t | _ t | j t  | j	 t
  t | j t
  | j	 d t d t  t | j t  d | _ x3 | j D]( } | d k rΟ q· n  t | | t  q· Wt | j t t Bt Bt Bt
 B t | j t  x3 | j D]( } | d k r5qn  t | | t  qWt | j d  d  S(   Ni    t   smoother_disturbancet   smoother_disturbance_covt   smoother_all(   R*   t   smoother_outputR8   t   smoother_stateR$   R   RT   R   R:   t   set_smoother_outputR   t   smoother_outputsR=   R   R   R    (   R>   R*   R?   (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   test_smoother_outputsά   s8    							c         C` s?   t  |  j j t  t  t  |  j j d t d t  t  d  S(   Nt   simulate_statet   simulate_disturbance(   R$   R*   t   get_simulation_outputR"   R8   R#   (   R>   (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   test_simulation_outputs  s    (   R1   R2   R@   RG   RK   RS   R[   R_   (    (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyR4   G   s   	(	&		+	,(0   t   __doc__t
   __future__R    R   R   t   numpyR(   t(   statsmodels.tsa.statespace.kalman_filterR   R   R   R   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t*   statsmodels.tsa.statespace.kalman_smootherR   R   R   R   R   R    t.   statsmodels.tsa.statespace.simulation_smootherR!   R"   R#   t   numpy.testingR$   t   objectR%   R4   (    (    (    sL   lib/python2.7/site-packages/statsmodels/tsa/statespace/tests/test_options.pyt   <module>	   s   .