ó
áp7]c           @` sÆ   d  Z  d d l m Z m Z m Z d d l Z d d l m Z m	 Z	 m
 Z
 d d l m Z d d l m Z d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   sI   
State Space Representation

Author: Chad Fulton
License: Simplified-BSD
i    (   t   divisiont   absolute_importt   print_functionNi   (   t   find_best_blas_typet   validate_matrix_shapet   validate_vector_shape(   t   Initialization(   t   toolst   OptionWrapperc           B` s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C` s   | |  _  | |  _ d  S(   N(   t   mask_attributet
   mask_value(   t   selfR	   R
   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   __init__   s    	c         C` s    t  t | |  j d ƒ |  j @ƒ S(   Ni    (   t   boolt   getattrR	   R
   (   R   t   objt   objtype(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   __get__   s    c         C` sV   t  | |  j d ƒ } t | ƒ r1 | |  j B} n | |  j @} t | |  j | ƒ d  S(   Ni    (   R   R	   R   R
   t   setattr(   R   R   t   valuet   mask_attribute_value(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   __set__   s
    (   t   __name__t
   __module__R   R   R   (    (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR      s   		t   MatrixWrapperc           B` s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C` s#   | |  _  | |  _ d | |  _ d  S(   Nt   _(   t   namet	   attributet
   _attribute(   R   R   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR   &   s    		c         C` s   t  | |  j d  ƒ } | S(   N(   R   R   t   None(   R   R   R   t   matrix(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR   +   s    c         C` sŽ   t  j | d d ƒ} | j |  j } t | ƒ d k rO |  j | | | ƒ } n |  j | | | ƒ } t | |  j | ƒ | j	 | j |  j <d  S(   Nt   ordert   Fi   (
   t   npt   asarrayt   shapesR   t   lent   _set_matrixt   _set_vectorR   R   t   shape(   R   R   R   R'   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR   2   s    c         C` sº   | j  d k rO | d d k rO | j d | d k rO | d  d  d  … f } n  t |  j | j | d | d | j ƒ | j  d k r¶ t j | d  d  … d  d  … d  f d d ƒ} n  | S(   Ni   i    i   R   R    (   t   ndimR'   R   R   R   t   nobsR!   t   array(   R   R   R   R'   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR%   >   s    $1c         C` s[   t  |  j | j | d | j ƒ | j d k rW t j | d  d  … d  f d d ƒ} n  | S(   Ni    i   R   R    (   R   R   R'   R)   R(   R!   R*   R   (   R   R   R   R'   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR&   O   s
    ((   R   R   R   R   R   R%   R&   (    (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR   %   s
   				t   Representationc           B` sg  e  Z d  Z d Z e d d ƒ Z e d d ƒ Z e d d ƒ Z e d d ƒ Z	 e d d ƒ Z
 e d	 d	 ƒ Z e d
 d ƒ Z d d d e j d d d d d d d d d „ Z d „  Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d „  Z d d d d „ Z d „  Z d d „ Z d „  Z d „  Z d d „ Z d e d „ Z  RS(   sI  
    State space representation of a time series process

    Parameters
    ----------
    k_endog : array_like or integer
        The observed time-series process :math:`y` if array like or the
        number of variables in the process if an integer.
    k_states : int
        The dimension of the unobserved state process.
    k_posdef : int, optional
        The dimension of a guaranteed positive definite covariance matrix
        describing the shocks in the measurement equation. Must be less than
        or equal to `k_states`. Default is `k_states`.
    initial_variance : float, optional
        Initial variance used when approximate diffuse initialization is
        specified. Default is 1e6.
    initialization : Initialization object or string, optional
        Initialization method for the initial state. If a string, must be one
        of {'diffuse', 'approximate_diffuse', 'stationary', 'known'}.
    initial_state : array_like, optional
        If `initialization='known'` is used, the mean of the initial state's
        distribution.
    initial_state_cov : array_like, optional
        If `initialization='known'` is used, the covariance matrix of the
        initial state's distribution.
    nobs : integer, optional
        If an endogenous vector is not given (i.e. `k_endog` is an integer),
        the number of observations can optionally be specified. If not
        specified, they will be set to zero until data is bound to the model.
    dtype : np.dtype, optional
        If an endogenous vector is not given (i.e. `k_endog` is an integer),
        the default datatype of the state space matrices can optionally be
        specified. Default is `np.float64`.
    design : array_like, optional
        The design matrix, :math:`Z`. Default is set to zeros.
    obs_intercept : array_like, optional
        The intercept for the observation equation, :math:`d`. Default is set
        to zeros.
    obs_cov : array_like, optional
        The covariance matrix for the observation equation :math:`H`. Default
        is set to zeros.
    transition : array_like, optional
        The transition matrix, :math:`T`. Default is set to zeros.
    state_intercept : array_like, optional
        The intercept for the transition equation, :math:`c`. Default is set to
        zeros.
    selection : array_like, optional
        The selection matrix, :math:`R`. Default is set to zeros.
    state_cov : array_like, optional
        The covariance matrix for the state equation :math:`Q`. Default is set
        to zeros.
    **kwargs
        Additional keyword arguments. Not used directly. It is present to
        improve compatibility with subclasses, so that they can use `**kwargs`
        to specify any default state space matrices (e.g. `design`) without
        having to clean out any other keyword arguments they might have been
        passed.

    Attributes
    ----------
    nobs : int
        The number of observations.
    k_endog : int
        The dimension of the observation series.
    k_states : int
        The dimension of the unobserved state process.
    k_posdef : int
        The dimension of a guaranteed positive
        definite covariance matrix describing
        the shocks in the measurement equation.
    shapes : dictionary of name:tuple
        A dictionary recording the initial shapes
        of each of the representation matrices as
        tuples.
    initialization : str
        Kalman filter initialization method. Default is unset.
    initial_variance : float
        Initial variance for approximate diffuse
        initialization. Default is 1e6.

    Notes
    -----
    A general state space model is of the form

    .. math::

        y_t & = Z_t \alpha_t + d_t + \varepsilon_t \\
        \alpha_t & = T_t \alpha_{t-1} + c_t + R_t \eta_t \\

    where :math:`y_t` refers to the observation vector at time :math:`t`,
    :math:`\alpha_t` refers to the (unobserved) state vector at time
    :math:`t`, and where the irregular components are defined as

    .. math::

        \varepsilon_t \sim N(0, H_t) \\
        \eta_t \sim N(0, Q_t) \\

    The remaining variables (:math:`Z_t, d_t, H_t, T_t, c_t, R_t, Q_t`) in the
    equations are matrices describing the process. Their variable names and
    dimensions are as follows

    Z : `design`          :math:`(k\_endog \times k\_states \times nobs)`

    d : `obs_intercept`   :math:`(k\_endog \times nobs)`

    H : `obs_cov`         :math:`(k\_endog \times k\_endog \times nobs)`

    T : `transition`      :math:`(k\_states \times k\_states \times nobs)`

    c : `state_intercept` :math:`(k\_states \times nobs)`

    R : `selection`       :math:`(k\_states \times k\_posdef \times nobs)`

    Q : `state_cov`       :math:`(k\_posdef \times k\_posdef \times nobs)`

    In the case that one of the matrices is time-invariant (so that, for
    example, :math:`Z_t = Z_{t+1} ~ \forall ~ t`), its last dimension may
    be of size :math:`1` rather than size `nobs`.

    References
    ----------
    .. [*] Durbin, James, and Siem Jan Koopman. 2012.
       Time Series Analysis by State Space Methods: Second Edition.
       Oxford University Press.
    t   designs   observation interceptt   obs_intercepts   observation covariance matrixt   obs_covt
   transitions   state interceptt   state_interceptt	   selections   state covariance matrixt	   state_covg    €„.Ai    c      
   K` s·  i  |  _  d  } t | t j ƒ ro | } | j d r_ | j d d k sS | d k r_ | j } n  | j d } n  | |  _ | d k  r“ t	 d ƒ ‚ n  | |  _
 | d k  r· t	 d ƒ ‚ n  | |  _ | d  k	 rÒ | n | |  _ |  j |  j k rü t	 d ƒ ‚ n  | d  k	 r|  j | ƒ n  i |  j |  j
 f d 6|  j |  j d f d 6|  j d f d	 6|  j |  j d f d
 6|  j |  j d f d 6|  j d f d 6|  j |  j d f d 6|  j |  j d f d 6|  _  t ƒ  } x |  j  j ƒ  D]n \ } } | d k rùqÛn  t |  d | t j | d | d d ƒƒ | | d  k	 rÛt |  | | | ƒ qÛqÛW| |  _ | d  k	 rh| n t j j ƒ  |  _ | j d d  ƒ |  _ d d d g } |  j | k rÀ|  j |  j ƒ nØ |  j d k rgd | k rè| d } n% d | k r| d } n t	 d ƒ ‚ d | k r&| d } n% d | k r?| d } n t	 d ƒ ‚ |  j d d | d | ƒn1 t |  j t ƒ r˜|  j d  k	 r˜t	 d ƒ ‚ n  i  |  _ i  |  _ d  |  _ d  S(   Nt   C_CONTIGUOUSi    i   sM   Number of endogenous variables in statespace model must be a positive number.s?   Number of states in statespace model must be a positive number.sZ   Dimension of state innovation `k_posdef` cannot be larger than the dimension of the state.t   obsR,   R-   R.   R/   R0   R1   R2   R   t   dtypeR   R    t   initializationt   diffuset   approximate_diffuset
   stationaryt   knownt   constantt   initial_statesS   Initial state must be provided when "known" is the specified initialization method.t   stationary_covt   initial_state_covse   Initial state covariance matrix must be provided when "known" is the specified initialization method.s*   Invalid state space initialization method.(   R#   R   t
   isinstanceR!   t   ndarrayt   flagsR'   t   Tt   k_endogt
   ValueErrorR)   t   k_statest   k_posdeft   bindt   localst   itemsR   t   zerost   initial_varianceR   t   prefix_statespace_mapt   copyt   getR6   t
   initializeR   t   _representationst   _statespacest   _time_invariant(   R   RC   RE   RF   RK   R)   R5   R,   R-   R.   R/   R0   R1   R2   t   statespace_classest   kwargst   endogt   scopeR   R'   t   basic_initsR;   R=   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR     s|    					)	
		c         C` s.  t  | ƒ } | t k r‡ | |  j k r: t d | ƒ ‚ n  t |  d | ƒ } | j d d k r€ | t d  ƒ f | j d d S| Sn£ | t	 k r| d | d } } | |  j k rÊ t d | ƒ ‚ n  t |  d | ƒ } | j d d k rt
 | ƒ | j d k r| d } n  | | St d ƒ ‚ d  S(	   Ns*   "%s" is an invalid state space matrix nameR   iÿÿÿÿi   i    s8   First index must the name of a valid state space matrix.(   i    (   i    (   t   typet   strR#   t
   IndexErrorR   R'   t   sliceR   R(   t   tupleR$   (   R   t   keyt   _typeR   R   t   slice_(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   __getitem__x  s&     ,c   	      C` sr  t  | ƒ } | t k rM | |  j k r: t d | ƒ ‚ n  t |  | | ƒ n!| t k rb| d | d } } | |  j k r” t d | d ƒ ‚ n  t j | ƒ j } t	 |  d | ƒ } d d d d g } | j | k r| j
 | k rt	 |  d | ƒ j j | ƒ } n  | j d	 d k rEt | ƒ | j d k rE| d } n  | | | <t |  | | ƒ n t d
 ƒ ‚ d  S(   Ns*   "%s" is an invalid state space matrix namei    i   R   t   ft   dR    t   Diÿÿÿÿs8   First index must the name of a valid state space matrix.(   i    (   RX   RY   R#   RZ   R   R\   R!   R*   R5   R   t   chart   realt   astypeR'   R$   R(   (	   R   R]   R   R^   R   R_   R5   R   t   valid_types(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   __setitem__ž  s*    ",
c         C` s`   |  j  |  j |  j |  j |  j |  j |  j f } |  j d k	 rR |  j f | } n  t	 | ƒ d S(   sO   
        (str) BLAS prefix of currently active representation matrices
        i    N(
   t   _designt   _obs_interceptt   _obs_covt   _transitiont   _state_interceptt
   _selectiont
   _state_covRU   R   R   (   R   t   arrays(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   prefixÇ  s    c         C` s   t  j |  j S(   sN   
        (dtype) Datatype of currently active representation matrices
        (   R   t   prefix_dtype_mapRq   (   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR5   Õ  s    c         C` s¤   |  j  d k r™ |  j j d |  j j d k o– |  j j d k o– |  j j d k o– |  j j d k o– |  j j d k o– |  j	 j d k SS|  j  Sd S(   sk   
        (bool) Whether or not currently active representation matrices are
        time-invariant
        i   i   N(
   RR   R   Ri   R'   Rj   Rk   Rl   Rm   Rn   Ro   (   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   time_invariantÜ  s    "**c         C` s'   |  j  } | |  j k r# |  j | Sd  S(   N(   Rq   RQ   R   (   R   Rq   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   _statespaceì  s    	c         C` s   |  j  S(   sN   
        (array) Observation vector: :math:`y~(k\_endog \times nobs)`
        (   RU   (   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR4   ó  s    c         C` sž  t  | t j ƒ s! t d ƒ ‚ n  | j d k rq |  j d k rX | j d d f | _ qq d | j d f | _ n  | j d k s t d ƒ ‚ n  | j d rµ | j d |  j k rµ ns | j d rä | j d |  j k rä | j } nD | j d r t d ƒ ‚ n( | j d rt d	 ƒ ‚ n t d
 ƒ ‚ | j d sGt j	 | ƒ } n  t j
 | ƒ |  _ | |  _ |  j j d |  _ t |  d ƒ rš|  j j |  j d <n  d S(   s&  
        Bind data to the statespace representation

        Parameters
        ----------
        endog : array
            Endogenous data to bind to the model. Must be column-ordered
            ndarray with shape (`k_endog`, `nobs`) or row-ordered ndarray with
            shape (`nobs`, `k_endog`).

        Notes
        -----
        The strict requirements arise because the underlying statespace and
        Kalman filtering classes require Fortran-ordered arrays in the wide
        format (shaped (`k_endog`, `nobs`)), and this structure is setup to
        prevent copying arrays in memory.

        By default, numpy arrays are row (C)-ordered and most time series are
        represented in the long format (with time on the 0-th axis). In this
        case, no copying or re-ordering needs to be performed, instead the
        array can simply be transposed to get it in the right order and shape.

        Although this class (Representation) has stringent `bind` requirements,
        it is assumed that it will rarely be used directly.
        s-   Invalid endogenous array; must be an ndarray.i   i    i   s9   Invalid endogenous array provided; must be 2-dimensional.t   F_CONTIGUOUSR3   sX   Invalid endogenous array; column-ordered arrays must have first axis shape of `k_endog`.sT   Invalid endogenous array; row-ordered arrays must have last axis shape of `k_endog`.s?   Invalid endogenous array; must be ordered in contiguous memory.R#   R4   N(   R?   R!   R@   RD   R(   RC   R'   RA   RB   t   asfortranarrayt   iscomplexobjt   _complex_endogRU   R)   t   hasattrR#   (   R   RU   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyRG   ú  s0    ##	c         C` sÙ   | d k r- t  |  j d d | d | ƒ} n | d k rl | d	 k rQ |  j } n  t  |  j d d | ƒ} nB | d k r t  |  j d ƒ } n! | d k r® t  |  j d ƒ } n  t | t  ƒ sÌ t d ƒ ‚ n  | |  _ d	 S(
   s,   Create an Initialization object if necessaryR:   R;   R=   R8   t   approximate_diffuse_varianceR9   R7   s*   Invalid state space initialization method.N(   R   RE   R   RK   R?   RD   R6   (   R   R6   Rz   R;   R=   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyRO   M  s"    c         C` sÇ   t  j | d d ƒ} t  j | d d ƒ} | j |  j f k sd t d |  j t | j ƒ f ƒ ‚ n  | j |  j |  j f k sª t d |  j |  j t | j ƒ f ƒ ‚ n  |  j d d | d | ƒd S(	   sâ  
        Initialize the statespace model with known distribution for initial
        state.

        These values are assumed to be known with certainty or else
        filled with parameters during, for example, maximum likelihood
        estimation.

        Parameters
        ----------
        constant : array_like
            Known mean of the initial state vector.
        stationary_cov : array_like
            Known covariance matrix of the initial state vector.
        R   R    sJ   Invalid dimensions for constant state vector. Requires shape (%d,), got %ssS   Invalid dimensions for stationary covariance matrix. Requires shape (%d,%d), got %sR:   R;   R=   N(   R!   R"   R'   RE   RD   RY   RO   (   R   R;   R=   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   initialize_knowne  s    c         C` s/   | d k r |  j } n  |  j d d | ƒd S(   sÑ  
        Initialize the statespace model with approximate diffuse values.

        Rather than following the exact diffuse treatment (which is developed
        for the case that the variance becomes infinitely large), this assigns
        an arbitrary large number for the variance.

        Parameters
        ----------
        variance : float, optional
            The variance for approximating diffuse initial conditions. Default
            is 1e6.
        R8   Rz   N(   R   RK   RO   (   R   t   variance(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   initialize_approximate_diffuse…  s    c         C` s   |  j  d ƒ d S(   s@   
        Initialize the statespace model as stationary.
        R9   N(   RO   (   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   initialize_stationary™  s    c         C` s   |  j  d ƒ d S(   s@   
        Initialize the statespace model as stationary.
        R7   N(   RO   (   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   initialize_diffuseŸ  s    c   	   
   C` s!  | d  k r |  j } n  t j | } | |  j k r± i  |  j | <xñ |  j j ƒ  D]Y } | d k rƒ |  j j | ƒ |  j | | <qQ t	 |  d | ƒ j | ƒ |  j | | <qQ Wn„ x |  j j ƒ  D]p } |  j | | } | d k rç qÁ t	 |  d | ƒ j | ƒ } | j
 | j
 k r | | (qÁ | |  j | | <qÁ W| |  j k r\|  j | } | j j
 d |  j j
 d k pV| j j
 d |  j j
 d k pV| j j
 d |  j j
 d k pV| j j
 d |  j j
 d k pV| j j
 d |  j j
 d k pV| j j
 d |  j j
 d k pV| j j
 d |  j j
 d k pV| j j
 d |  j j
 d k } n t } | r| |  j k r„|  j | =n  |  j | } | |  j | d |  j | d |  j | d |  j | d |  j | d |  j | d	 |  j | d
 |  j | d ƒ |  j | <n  | | | f S(   NR4   R   i   i   R,   R-   R.   R/   R0   R1   R2   (   R   Rq   R   Rr   RP   R#   t   keysR4   Rf   R   R'   RQ   RU   R,   R-   R.   R/   R0   R1   R2   t   TrueRL   (	   R   Rq   R5   R   t   existingt   newt   sst   createt   cls(    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   _initialize_representation¥  sV     .!!!!!!$c         C` su   | d  k r |  j } n  t |  j t ƒ re |  j j sE t d ƒ ‚ n  |  j | j |  j d | ƒn t d ƒ ‚ d  S(   Ns   Initialization is incomplete.t   complex_steps!   Statespace model not initialized.(	   R   Rq   R?   R6   R   t   initializedt   RuntimeErrorRQ   RO   (   R   Rq   Rˆ   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   _initialize_stateí  s    
N(!   R   R   t   __doc__R   RU   R   R,   R-   R.   R/   R0   R1   R2   R!   t   float64R   R`   Rh   t   propertyRq   R5   Rs   Rt   R4   RG   RO   R{   R}   R~   R   R‡   t   FalseR‹   (    (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR+   \   s<   		r	&	)	S	 		Ht   FrozenRepresentationc           B` sq   e  Z d  Z d d d d d d d d d	 d
 d d d d d d d d d d d d d g Z e Z d „  Z d „  Z RS(   sƒ  
    Frozen Statespace Model

    Takes a snapshot of a Statespace model.

    Parameters
    ----------
    model : Representation
        A Statespace representation

    Attributes
    ----------
    nobs : int
        Number of observations.
    k_endog : int
        The dimension of the observation series.
    k_states : int
        The dimension of the unobserved state process.
    k_posdef : int
        The dimension of a guaranteed positive definite
        covariance matrix describing the shocks in the
        measurement equation.
    dtype : dtype
        Datatype of representation matrices
    prefix : str
        BLAS prefix of representation matrices
    shapes : dictionary of name:tuple
        A dictionary recording the shapes of each of
        the representation matrices as tuples.
    endog : array
        The observation vector.
    design : array
        The design matrix, :math:`Z`.
    obs_intercept : array
        The intercept for the observation equation, :math:`d`.
    obs_cov : array
        The covariance matrix for the observation equation :math:`H`.
    transition : array
        The transition matrix, :math:`T`.
    state_intercept : array
        The intercept for the transition equation, :math:`c`.
    selection : array
        The selection matrix, :math:`R`.
    state_cov : array
        The covariance matrix for the state equation :math:`Q`.
    missing : array of bool
        An array of the same size as `endog`, filled
        with boolean values that are True if the
        corresponding entry in `endog` is NaN and False
        otherwise.
    nmissing : array of int
        An array of size `nobs`, where the ith entry
        is the number (between 0 and `k_endog`) of NaNs in
        the ith row of the `endog` array.
    time_invariant : bool
        Whether or not the representation matrices are time-invariant
    initialization : Initialization object
        Kalman filter initialization method.
    initial_state : array_like
        The state vector used to initialize the Kalamn filter.
    initial_state_cov : array_like
        The state covariance matrix used to initialize the Kalamn filter.
    t   modelRq   R5   R)   RC   RE   RF   Rs   RU   R,   R-   R.   R/   R0   R1   R2   t   missingt   nmissingR#   R6   R<   R>   RK   c         C` s5   x! |  j  D] } t |  | d  ƒ q
 W|  j | ƒ d  S(   N(   t   _attributesR   R   t   update_representation(   R   R‘   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR   G  s    c         C` s6  | |  _  | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j |  _ | j	 j
 ƒ  |  _ | j j
 ƒ  |  _ | j j
 ƒ  |  _ | j j
 ƒ  |  _ | j j
 ƒ  |  _ | j j
 ƒ  |  _ | j j
 ƒ  |  _ t j | j |  j j d t ƒ|  _ t j | j |  j j d t ƒ|  _ t | j ƒ |  _ xB |  j j  ƒ  D]1 } | d k rkqSn  t! |  | ƒ j" |  j | <qSW|  j j" |  j d <| j# |  _# | j# d k	 r2| j% ƒ  t j | j |  j j& d t ƒ|  _& t j | j |  j j' d t ƒ|  _' t j | j |  j j( d t ƒ|  _( n  d S(   s   Update model RepresentationRM   R4   N()   R‘   Rq   R5   R)   RC   RE   RF   Rs   RU   Ri   RM   R,   Rj   R-   Rk   R.   Rl   R/   Rm   R0   Rn   R1   Ro   R2   R!   R*   RQ   R’   R   R“   t   dictR#   R€   R   R'   R6   R   R‹   R<   R>   t   initial_diffuse_state_cov(   R   R‘   R   (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR•   O  sH    	
(   R   R   RŒ   t   _model_attributesR”   R   R•   (    (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyR   þ  s   ?	(   RŒ   t
   __future__R    R   R   t   numpyR!   R   R   R   R   R6   R   t    t   objectR   R   R+   R   (    (    (    sH   lib/python2.7/site-packages/statsmodels/tsa/statespace/representation.pyt   <module>   s   7ÿ ÿ ¤