
p7]c           @` sh  d  Z  d d l m Z m Z m Z d d l m Z d d l m Z d d l	 Z
 d d l Z d d l m Z d d l m Z d d l m Z d d l j j Z d d	 l m Z m Z d
 d l m Z m Z d
 d l m Z m Z m  Z  d
 d l! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' d e f d     YZ( d e f d     YZ) d e  f d     YZ* e j+ e* e)  d S(   ss   
Vector Autoregressive Moving Average with eXogenous regressors model

Author: Chad Fulton
License: Simplified-BSD
i    (   t   divisiont   absolute_importt   print_function(   t   warn(   t   OrderedDictN(   t   Bunch(   t   _is_using_pandas(   t	   var_model(   t   EstimationWarningt   ValueWarningi   (   t   INVERT_UNIVARIATEt   SOLVE_LU(   t   MLEModelt
   MLEResultst   MLEResultsWrapper(   t   is_invertiblet   prepare_exogt!   constrain_stationary_multivariatet#   unconstrain_stationary_multivariatet   prepare_trend_spect   prepare_trend_datat   VARMAXc           B` st   e  Z d  Z d d d d e e e d  Z e d    Z e d    Z	 e d    Z
 d	   Z d
   Z d   Z RS(   s  
    Vector Autoregressive Moving Average with eXogenous regressors model

    Parameters
    ----------
    endog : array_like
        The observed time-series process :math:`y`, , shaped nobs x k_endog.
    exog : array_like, optional
        Array of exogenous regressors, shaped nobs x k.
    order : iterable
        The (p,q) order of the model for the number of AR and MA parameters to
        use.
    trend : str{'n','c','t','ct'} or iterable, optional
        Parameter controlling the deterministic trend polynomial :math:`A(t)`.
        Can be specified as a string where 'c' indicates a constant (i.e. a
        degree zero component of the trend polynomial), 't' indicates a
        linear trend with time, and 'ct' is both. Can also be specified as an
        iterable defining the polynomial as in `numpy.poly1d`, where
        `[1,1,0,1]` would denote :math:`a + bt + ct^3`. Default is a constant
        trend component.
    error_cov_type : {'diagonal', 'unstructured'}, optional
        The structure of the covariance matrix of the error term, where
        "unstructured" puts no restrictions on the matrix and "diagonal"
        requires it to be a diagonal matrix (uncorrelated errors). Default is
        "unstructured".
    measurement_error : boolean, optional
        Whether or not to assume the endogenous observations `endog` were
        measured with error. Default is False.
    enforce_stationarity : boolean, optional
        Whether or not to transform the AR parameters to enforce stationarity
        in the autoregressive component of the model. Default is True.
    enforce_invertibility : boolean, optional
        Whether or not to transform the MA parameters to enforce invertibility
        in the moving average component of the model. Default is True.
    kwargs
        Keyword arguments may be used to provide default values for state space
        matrices or for Kalman filtering options. See `Representation`, and
        `KalmanFilter` for more details.

    Attributes
    ----------
    order : iterable
        The (p,q) order of the model for the number of AR and MA parameters to
        use.
    trend : str{'n','c','t','ct'} or iterable
        Parameter controlling the deterministic trend polynomial :math:`A(t)`.
        Can be specified as a string where 'c' indicates a constant (i.e. a
        degree zero component of the trend polynomial), 't' indicates a
        linear trend with time, and 'ct' is both. Can also be specified as an
        iterable defining the polynomial as in `numpy.poly1d`, where
        `[1,1,0,1]` would denote :math:`a + bt + ct^3`.
    error_cov_type : {'diagonal', 'unstructured'}, optional
        The structure of the covariance matrix of the error term, where
        "unstructured" puts no restrictions on the matrix and "diagonal"
        requires it to be a diagonal matrix (uncorrelated errors). Default is
        "unstructured".
    measurement_error : boolean, optional
        Whether or not to assume the endogenous observations `endog` were
        measured with error. Default is False.
    enforce_stationarity : boolean, optional
        Whether or not to transform the AR parameters to enforce stationarity
        in the autoregressive component of the model. Default is True.
    enforce_invertibility : boolean, optional
        Whether or not to transform the MA parameters to enforce invertibility
        in the moving average component of the model. Default is True.

    Notes
    -----
    Generically, the VARMAX model is specified (see for example chapter 18 of
    [1]_):

    .. math::

        y_t = A(t) + A_1 y_{t-1} + \dots + A_p y_{t-p} + B x_t + \epsilon_t +
        M_1 \epsilon_{t-1} + \dots M_q \epsilon_{t-q}

    where :math:`\epsilon_t \sim N(0, \Omega)`, and where :math:`y_t` is a
    `k_endog x 1` vector. Additionally, this model allows considering the case
    where the variables are measured with error.

    Note that in the full VARMA(p,q) case there is a fundamental identification
    problem in that the coefficient matrices :math:`\{A_i, M_j\}` are not
    generally unique, meaning that for a given time series process there may
    be multiple sets of matrices that equivalently represent it. See Chapter 12
    of [1]_ for more information. Although this class can be used to estimate
    VARMA(p,q) models, a warning is issued to remind users that no steps have
    been taken to ensure identification in this case.

    References
    ----------
    .. [1] Lütkepohl, Helmut. 2007.
       New Introduction to Multiple Time Series Analysis.
       Berlin: Springer.

    i   i    t   ct   unstructuredc	      	   ` s  |   _  |   _ |   _ |   _ |   _ |   _ t | d    _ t | d    _ | d k rw t	 d   n    j d k r   j d k r t	 d   n    j d k r   j d k r t
 d t  n  |   _ t   j  \   _   _   j j d k o  j d d k   _ t |  \   _ }   j d k   _ t | d   sft j |  } n  t   j d  }
 |
   j   _ | j d } | } |   j } |	 j d d	  |	 j d
 t t B t t    j  | d | d | d | |	   j d k s  j d k r.  j r.t!   j" _# n  t$     _%   j&   j   j% d <  j& d   j   j% d <  j& d   j   j% d <  j&   j   j% d <  j  d k r  j&   j% d <n7   j  d k rt   j&   j& d d    j% d <n    j&   j   j% d <t'   j% j(      _) t*   j   j   j+ d d   _,   j d k rc  j sr  j d k rt j-   j.   j+ f    j" d <n  t j/   j&  } d   j" d | <  j d k rt j/   j d   j&  } | d   j& | d f } d   j" d | <n  t j/   j d   j&  } | d |
 d   j& | d |
   j& f } d   j" d | <t j/   j&  } d   j" d  | <| d |
   j& | d f }   j d k rd   j" d! | <n    j r  j d k rt j0 d d  |  d  d   f   _1 nF   j d k s4  j d k r\t j0 d d  |  d  d  f   _1 n    j d k rt j0 d d  |  d  d   f   _2 n% t j0 d d  |  | d   f   _2   j  d k rd" t j/   j&    _3 n'   j  d k r
t j4   j&    _5 n    j r/d# t j/   j&    _6 n    f d   } d } | d |  \   _7 } | d |  \   _8 } | d |  \   _9 } | d |  \   _: } | d |  \   _; } | d |  \   _< } d  S($   Ni    i   t   diagonalR   s3   Invalid error covariance matrix type specification.sN   Invalid VARMAX(p,q) specification; at least one p,q must be greater than zero.sc   Estimation of VARMA(p,q) models is not generically robust, due especially to identification issues.t   initializationt
   stationaryt   inversion_methodt   exogt   k_statest   k_posdeft   trendi   t   art   mat
   regressiont	   state_covt   obs_covt   offsett   state_interceptt   designt
   transitiont	   selectionic         ` s5     j  |  } t j | | | !} | | 7} | | f S(   N(   t
   parameterst   npt   s_(   t   keyR%   t   lengtht   param_slice(   t   self(    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyt   _slice  s    
(   R   R   (   R'   (   R(   (   R(   (   R)   (   R)   (   R#   (   R$   (=   t   error_cov_typet   measurement_errort   enforce_stationarityt   enforce_invertibilityt   orderR   t   intt   k_art   k_mat
   ValueErrorR   R   R   t   polynomial_trendt   k_trendt   sizet   _trend_is_constR   t   k_exogt   mle_regressionR   t   NoneR+   t
   asanyarrayt   maxt   _k_ordert   shapet
   setdefaultR
   R   t   superR   t   __init__t   Falset   ssmt   _time_invariantR   R*   t   k_endogt   sumt   valuest   k_paramsR   t   nobst   _trend_datat   zerosR   t   diag_indicesR,   t   _idx_state_interceptt   _idx_transitiont   _idx_state_covt   tril_indicest   _idx_lower_state_covt   _idx_obs_covt   _params_trendt
   _params_art
   _params_mat   _params_regressiont   _params_state_covt   _params_obs_cov(   R0   t   endogR   R6   R   R2   R3   R4   R5   t   kwargst	   _min_k_arRL   R   R   t   idxR1   R%   (    (   R0   s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyRH      s    						
	((!(%(((%	c         C` s   i t  t f d 6S(   Nt   fit(   t   VARMAXResultst   VARMAXResultsWrapper(   R0   (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyt   _res_classes%  s    c         C` s  t  j |  j d t  j } t j |  j j    } y | j   } Wn t	 k
 rV n X| j
 d d  j } d  } |  j d k r |  j d k r t  j |  j |  j f } n6 |  j d k r |  j } n |  j d k r |  j } n  t  j t  j |   r?t  j t  j |  d d } | | } | d  k	 r?| | } q?n  t  j d  } t  j d  } |  j d k s{|  j d k rt  j j |  j |  } | t  j | |  8} |  j d k r| |  j  j } n  |  j d k r| |  j j } qn  g  } |  j d k r|  j n d }	 t j |  }
 |
 j d |	 d d  d	 d
  } |  j d k rqt  j | j  j j   } n  | j  } |  j d k r	|  j! r	| j" |  j |  j |  j  j j" |  j |  j |  j  j } t# d g t$ |   } | s	t% d  | d 9} q	n  g  } |  j& d k rt j |  } | j d |  j& d d  d	 d
  } t  j | j j  j   } |  j' r| j" |  j |  j& |  j  j j" |  j |  j |  j&  j } t# d g t$ |   } | st% d  | d 9} qqn  |  j d k r
|  j d k s|  j( r| j" |  j |  j |  j  j j" |  j |  j |  j  j } t  j) |  j  t  j* | d d } |  j d k rt  j | |  } n  |  j( d k rt  j | |  } qn  |  j d k r| j   | |  j+ <n  |  j d k r| | |  j, <n  |  j& d k r#| | |  j- <n  |  j( rB| j   | |  j. <n  |  j/ d k rj| j0 j1   | |  j2 <nA |  j/ d k rt  j j3 | j0  } | |  j4 j   | |  j2 <n  |  j5 r|  j& d k r| j0 j1   | |  j6 <q| j0 j1   | |  j6 <n  | S(   Nt   dtypet   methodt   backfilli    t   axisi   t   maxlagst   icR   t   ncs\   Non-stationary starting autoregressive parameters found. Using zeros as starting parameters.s\   Non-stationary starting moving-average parameters found. Using zeros as starting parameters.R   R   (7   R+   RR   RO   t   float64t   pdt	   DataFrameR`   t   copyt   interpolatet	   TypeErrort   fillnaRN   RA   R<   R?   t   c_RQ   R   t   anyt   isnant   linalgt   pinvt   dott   TRL   R8   R   t   VARRd   t   arrayt   paramst   ravelt   residR4   t   reshapeR   t   listR   R9   R5   R@   t   eyeRM   RZ   R[   R\   R]   R2   t   sigma_uR   R^   t   choleskyRX   R3   R_   (   R0   R   R`   R   t   maskt   trend_paramst   exog_paramst   trendexog_paramst	   ar_paramsR8   t   mod_art   res_art   coefficient_matricesR   t	   ma_paramst   mod_mat   res_mat
   invertiblet   tmpt
   cov_factor(    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyt   start_params)  s    
	
!	
'%		c      
   C` s+  g  } |  j  d k r x |  j j   d D] } | d k ro | g  t |  j  D] } d |  j | ^ qN 7} q) | d k r | g  t |  j  D] } d |  j | ^ q 7} q) | g  t |  j  D] } d | |  j | f ^ q 7} q) Wn  | g  t |  j  D]W } t |  j  D]A } t |  j  D]+ } d | d |  j | |  j | f ^ q&qq 7} | g  t |  j  D]W } t |  j  D]A } t |  j  D]+ } d | d |  j | |  j | f ^ qqqq7} | g  t |  j  D]: } t |  j  D]$ } d |  j	 | |  j | f ^ qq7} |  j
 d	 k rf| g  t |  j  D] } d
 |  j | ^ qE7} n |  j
 d k r| g  t |  j  D]X } t | d  D]A } | | k rd |  j | n d |  j | |  j | f ^ qq7} n  |  j r'| g  t |  j  D] } d |  j | ^ q7} n  | S(   Ni    s   intercept.%si   s   drift.%ss   trend.%d.%ss	   L%d.%s.%ss   L%d.e(%s).%ss
   beta.%s.%sR   s	   sigma2.%sR   s   sqrt.var.%ss   sqrt.cov.%s.%ss   measurement_variance.%s(   R<   R;   t   nonzerot   rangeRL   t   endog_namesR8   R9   R?   t
   exog_namesR2   R3   (   R0   t   param_namest   it   jt   k(    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyR     sN    ..8EE;.\	.c         C` sn  t  j | d d } t  j | j d | j } | |  j | |  j <|  j d k r6|  j r6|  j d k r t  j	 | |  j
 d  } n] |  j d k r t  j |  j d j d | j } | |  j
 | |  j <t  j | | j  } n  | |  j j |  j |  j |  j  } t | |  \ } } | j   | |  j <n | |  j | |  j <|  j d k r|  j rt  j |  j d | j } | |  j j |  j |  j |  j  } t | |  \ } } | j   | |  j <n | |  j | |  j <| |  j | |  j <|  j d k r | |  j
 d | |  j
 <n& |  j d k rF| |  j
 | |  j
 <n  |  j rj| |  j d | |  j <n  | S(	   sZ  
        Transform unconstrained parameters used by the optimizer to constrained
        parameters used in likelihood evaluation

        Parameters
        ----------
        unconstrained : array_like
            Array of unconstrained parameters used by the optimizer, to be
            transformed.

        Returns
        -------
        constrained : array_like
            Array of constrained parameters which may be used in likelihood
            evalation.

        Notes
        -----
        Constrains the factor transition to be stationary and variances to be
        positive.
        t   ndmini   Rh   i    R   i   R   R#   (   R+   R~   RR   RE   Rh   RZ   R8   R4   R2   t   diagR^   RJ   RX   R{   R|   R[   R   RL   R   R   R9   R5   R   R\   R]   R3   R_   (   R0   t   unconstrainedt   constrainedR#   t   state_cov_lowert   coefficientsR   t   variance(    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyt   transform_params  s>    	c         C` sj  t  j | d d } t  j | j d | j } | |  j | |  j <|  j d k r2|  j r2|  j d k r t  j	 | |  j
  } n] |  j d k r t  j |  j d j d | j } | |  j
 | |  j <t  j | | j  } n  | |  j j |  j |  j |  j  } t | |  \ } } | j   | |  j <n | |  j | |  j <|  j d k r|  j rt  j |  j d | j } | |  j j |  j |  j |  j  } t | |  \ } } | j   | |  j <n | |  j | |  j <| |  j | |  j <|  j d k r| |  j
 d | |  j
 <n& |  j d k rB| |  j
 | |  j
 <n  |  j rf| |  j d | |  j <n  | S(	   s  
        Transform constrained parameters used in likelihood evaluation
        to unconstrained parameters used by the optimizer.

        Parameters
        ----------
        constrained : array_like
            Array of constrained parameters used in likelihood evalution, to be
            transformed.

        Returns
        -------
        unconstrained : array_like
            Array of unconstrained parameters used by the optimizer.
        R   i   Rh   i    R   R   R#   g      ?(   R+   R~   RR   RE   Rh   RZ   R8   R4   R2   R   R^   RJ   RX   R{   R|   R[   R   RL   R   R   R9   R5   R   R\   R]   R3   R_   (   R0   R   R   R#   R   R   t   unconstrained_matricesR   (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyt   untransform_paramsA  s>    	c         K` s  t  t |   j | |  } |  j ru | |  j j |  j |  j  j } t	 j
 |  j d |  } | j |  j |  j <n  |  j d k r!|  j s t	 j d d | j } | |  j |  j <n  | |  j j |  j |  j  j } |  j r | } n t	 j
 |  j d |  } |  j |  j c | j 7<n  |  j rgt	 j t	 j d | j } | |  j d d  |  j  d f <n  | |  j j |  j |  j |  j  } | |  j j |  j |  j |  j  }	 t	 j | |	 f |  j |  j <|  j d k r| |  j |  j |  j <nd |  j d k r]t	 j |  j d j d | j }
 | |  j |
 |  j  <t	 j
 |
 |
 j  |  j d <n  |  j! r| |  j" |  j |  j# <n  d  S(	   Ni   i    Rh   R&   iR   R   R#   ($   RG   R   t   updateR@   R]   R   RL   R?   R|   R+   R{   R   RJ   RT   R<   R~   Rh   RZ   R>   RQ   t   nanR[   R8   R\   R9   Rv   RU   R2   R^   RV   RR   RE   RX   R3   R_   RY   (   R0   R   Ra   R   t	   interceptt   zeroR   R   R    R!   R   (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyR     sB    					"	N(   i   i    (   t   __name__t
   __module__t   __doc__RA   RI   t   TrueRH   t   propertyRg   R   R   R   R   R   (    (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyR      s   _	?	S	MRe   c           B` sV   e  Z d  Z d d d  Z d d e d d d  Z d d e d  Z e	 j j e _ RS(   s  
    Class to hold results from fitting an VARMAX model.

    Parameters
    ----------
    model : VARMAX instance
        The fitted model instance

    Attributes
    ----------
    specification : dictionary
        Dictionary including all attributes from the VARMAX model instance.
    coefficient_matrices_var : array
        Array containing autoregressive lag polynomial coefficient matrices,
        ordered from lowest degree to highest.
    coefficient_matrices_vma : array
        Array containing moving average lag polynomial coefficients,
        ordered from lowest degree to highest.

    See Also
    --------
    statsmodels.tsa.statespace.kalman_filter.FilterResults
    statsmodels.tsa.statespace.mlemodel.MLEResults
    t   opgc         K` s  t  t |   j | | | | | |  t i
 |  j j d 6|  j j d 6|  j j d 6|  j j d 6|  j j	 d 6|  j j
 d 6|  j j d 6|  j j d 6|  j j d	 6|  j j d
 6  |  _ d  |  _ d  |  _ |  j j
 d k r?t j |  j |  j j  } |  j j } |  j j
 }	 | j | |	 |  j j | | |	  j |  _ n  |  j j d k rt j |  j |  j j  }
 |  j j } |  j j } |
 j | | |  j j | | |  j |  _ n  d  S(   NR2   R3   R4   R5   R6   R8   R9   R   R<   R?   i    (   RG   Re   RH   R   t   modelR2   R3   R4   R5   R6   R8   R9   R   R<   R?   t   specificationRA   t   coefficient_matrices_vart   coefficient_matrices_vmaR+   R~   R   R[   RL   R   R|   R\   (   R0   R   R   t   filter_resultst   cov_typet   cov_kwdsRa   R   RL   R8   R   R9   (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyRH     s6    		c         K` s  | d k r |  j j d } n  |  j j | | | d t \ } } }	 }
 d } |	 r|  j j |  j j d k r|  j j j j	 d |	 } t
 j | |  j j f  } |  j j d k rS| d k r t d   n  t
 j |  } |	 |  j j f } | j	 | k s+t d t |  t | j	  f   n  t
 j |  j j j j | j f j } n  t | d | d |  j j d |  j j d |  j j d	 |  j j d
 |  j j d |  j j } | j |  j  | d j d k r| d d d  |  j d f } n | d d d  d f } x |  j j j    D] } | d k r7qn  t! | j" |  } | j	 d d k rt# | j	  d k r| d d  |	 d  f | | <q| d d  d d  |	 d  f | | <qqWn. |  j j d k r| d k	 rt$ d t%  n  | d k	 r"| |  j j& d d  d f <n  t' t( |   j) d | d | d | d | d | |  } | d k	 rt
 j* |  j j& d d  d f <n  | S(   sO  
        In-sample prediction and out-of-sample forecasting

        Parameters
        ----------
        start : int, str, or datetime, optional
            Zero-indexed observation number at which to start forecasting, ie.,
            the first forecast is start. Can also be a date string to
            parse or a datetime type. Default is the the zeroth observation.
        end : int, str, or datetime, optional
            Zero-indexed observation number at which to end forecasting, ie.,
            the first forecast is start. Can also be a date string to
            parse or a datetime type. However, if the dates index does not
            have a fixed frequency, end must be an integer index if you
            want out of sample prediction. Default is the last observation in
            the sample.
        exog : array_like, optional
            If the model includes exogenous regressors, you must provide
            exactly enough out-of-sample values for the exogenous variables if
            end is beyond the last observation in the sample.
        dynamic : boolean, int, str, or datetime, optional
            Integer offset relative to `start` at which to begin dynamic
            prediction. Can also be an absolute date string to parse or a
            datetime type (these are not interpreted as offsets).
            Prior to this observation, true endogenous values will be used for
            prediction; starting with this observation and continuing through
            the end of prediction, forecasted endogenous values will be used
            instead.
        kwargs
            Additional arguments may required for forecasting beyond the end
            of the sample. See `FilterResults.predict` for more details.

        Returns
        -------
        forecast : array
            Array of out of sample forecasts.
        i    t   silents~   Out-of-sample forecasting in a model with a regression component requires additional exogenous values via the `exog` argument.sP   Provided exogenous values are not of the appropriate shape. Required %s, got %s.R   R6   R   R2   R3   R4   R5   R&   i   Nt   obsii   s_   Exogenous array provided to predict, but additional data not required. `exog` argument ignored.t   startt   endt   dynamict   index(+   RA   R   t   _indext   _get_prediction_indexR   R?   R<   t   datat
   orig_endogRE   R+   RR   RL   R:   R~   t   strRv   t	   orig_exogR|   R   R6   R   R2   R3   R4   R5   R   R   t   ndimRP   R   t   shapest   keyst   getattrRJ   t   lenR   R	   R&   RG   Re   t   get_predictionR   (   R0   R   R   R   R   R   Ra   t   _startt   _endt   _out_of_samplet   prediction_indext   last_interceptRP   R`   t   required_exog_shapeR   t   namet   matt   res(    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyR   
  sb    '*"	(#$4
	"g?c      	   ` s  d d l  m  |  j } | j d k rV | j d k rV d } d | j | j f } n8 | j d k r{ d } d | j } n d } d | j } | j d k r | d 7} n  | | g } | j d k r | j d	  n  | j r | j d
  n  t	 t
 |   j d   d | d | d |  } | rt j t |  j   } t    f d  }	 |  j j }
 |  j j } |  j j } |  j j } |  j j } g  } xt |
  D]} g  } d } | d k r| j t j | | |
 | |
   | |
 | 7} n  | d k rP| |
 | } | d |
 | } | j | t j | |   | | |
 d 7} n  | d k r| |
 | } | d |
 | } | j | t j | |   | | |
 d 7} n  | d k r| j | t j | | | d |   | |
 | 7} n  |  j j r-| j t j |  j j | d d d  n  t j |  } | j |  d |  j j | } |	 |  | |  } | j j |  qWt j t |  j   |  j j } |	 |  | d d t } | j j |  g  } xN | | g f D]= } t j |  j   } t |  d k r| j |  qqWt j |  } t j t t |  j t |     } t |  d k r|	 |  | d d t } | j j |  qn  | S(   Ni    (   t   summary_paramst   VARMAs   (%s,%s)R}   s   (%s)t   VMAt   XR   s   measurement errort   alphaR   t
   model_namet   display_paramsc         ` s   |  |  j  | |  j | |  j | |  j | |  j    | f } g  t j |  j j  | j	   D]. } | r d j
 | j d  d   n | ^ qa }  | d d  d | d   d t d | S(   Nt   .it   ynamet   xnameR   t   use_tt   title(   R   t   bset   zvaluest   pvaluest   conf_intR+   R~   R   R   t   tolistt   joint   splitRA   RI   (   R0   R   R   t	   strip_endR   R   R   (   R   R   (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyt
   make_table  s    Qi   i   R   s   Results for equation %ss   Error covariance matrixR   s   Other parameters(   t   statsmodels.iolib.summaryR   R   R8   R9   R?   R<   t   appendR3   RG   Re   t   summaryR+   t   arangeR   R   R   R   RL   R   R~   RO   t   concatenateR   t   tablesR^   RI   t   flattenR   t   sett
   difference(   R0   R   R   t   separate_paramst   specR   R6   R   t   indicesR   RL   R8   R9   R<   R?   t   endog_masksR   t   masksR%   R   R   R   t   tablet   state_cov_maskt   mt   inverse_mask(    (   R   R   s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyR   ~  s    		
$#'"	*	N(
   R   R   R   RA   RH   RI   R   R   R   R   (    (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyRe     s   )svRf   c           B` s>   e  Z i  Z e j e j e  Z i  Z e j e j e  Z RS(    (	   R   R   t   _attrst   wrapt   union_dictsR   t   _wrap_attrst   _methodst   _wrap_methods(    (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyRf     s   	(,   R   t
   __future__R    R   R   t   warningsR   t   collectionsR   t   pandasRp   t   numpyR+   t   statsmodels.tools.toolsR   t   statsmodels.tools.dataR   t   statsmodels.tsa.vector_arR   t   statsmodels.base.wrappert   baset   wrapperR   t   statsmodels.tools.sm_exceptionsR   R	   t   kalman_filterR
   R   t   mlemodelR   R   R   t   toolsR   R   R   R   R   R   R   Re   Rf   t   populate_wrapper(    (    (    s@   lib/python2.7/site-packages/statsmodels/tsa/statespace/varmax.pyt   <module>   s(   .   1