ó
áp7]c           @   sô   d  d l  Z d  d l Z d  d l m Z d  d l j Z d e f d „  ƒ  YZ	 d e	 f d „  ƒ  YZ
 d e	 f d „  ƒ  YZ d	 e	 f d
 „  ƒ  YZ d e	 f d „  ƒ  YZ d e f d „  ƒ  YZ d e	 f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z d S(   iÿÿÿÿN(   t   statst   BaseProbplotMixinc           B   sL  e  Z d  „  Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z	 e j j d „  ƒ Z
 e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d	 „  ƒ Z e j j d
 „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z RS(   c         C   sy   y+ d d  l  j } | j ƒ  \ |  _ |  _ Wn t k
 r> n Xt j j d |  j	 j
 j ƒ |  _ t j |  j ƒ |  _ d  S(   Niÿÿÿÿt   size(   t   matplotlib.pyplott   pyplott   subplotst   figt   axt   ImportErrort   npt   randomt   normalt   prbpltt   datat   shapet   other_arrayt   smt   ProbPlott   other_prbplot(   t   selft   plt(    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   setup	   s    !c         C   s#   |  j  j d |  j d |  j ƒ d  S(   NR   t   line(   R   t   qqplotR   R   (   R   t   close_figures(    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_qqplot   s    c         C   s#   |  j  j d |  j d |  j ƒ d  S(   NR   R   (   R   t   ppplotR   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_ppplot   s    c         C   s#   |  j  j d |  j d |  j ƒ d  S(   NR   R   (   R   t   probplotR   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_probplot   s    c         C   s,   |  j  j d |  j d |  j d |  j ƒ d  S(   NR   R   t   other(   R   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_qqplot_other_array   s    c         C   s,   |  j  j d |  j d |  j d |  j ƒ d  S(   NR   R   R   (   R   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_ppplot_other_array#   s    c         C   s,   |  j  j d |  j d |  j d |  j ƒ d  S(   NR   R   R   (   R   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   t_est_probplot_other_array(   s    c         C   s,   |  j  j d |  j d |  j d |  j ƒ d  S(   NR   R   R   (   R   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_qqplot_other_prbplt-   s    c         C   s,   |  j  j d |  j d |  j d |  j ƒ d  S(   NR   R   R   (   R   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_ppplot_other_prbplt2   s    c         C   s,   |  j  j d |  j d |  j d |  j ƒ d  S(   NR   R   R   (   R   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   t_est_probplot_other_prbplt7   s    c      	   C   s/   |  j  j d |  j d |  j d d d d ƒ d  S(   NR   R   t   xlabels   Custom X-Labelt   ylabels   Custom Y-Label(   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_qqplot_custom_labels<   s    c      	   C   s/   |  j  j d |  j d |  j d d d d ƒ d  S(   NR   R   R%   s   Custom X-LabelR&   s   Custom Y-Label(   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_ppplot_custom_labelsB   s    c      	   C   s/   |  j  j d |  j d |  j d d d d ƒ d  S(   NR   R   R%   s   Custom X-LabelR&   s   Custom Y-Label(   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_probplot_custom_labelsH   s    c         C   s;   |  j  j d |  j d |  j d d d d d d d	 d
 ƒ d  S(   NR   R   t   markert   dt   markerfacecolort   cornflowerbluet   markeredgecolort   whitet   alphag      à?(   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_qqplot_pltkwargsN   s
    c         C   s;   |  j  j d |  j d |  j d d d d d d d	 d
 ƒ d  S(   NR   R   R*   R+   R,   R-   R.   R/   R0   g      à?(   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_ppplot_pltkwargsV   s
    c         C   s;   |  j  j d |  j d |  j d d d d d d d	 d
 ƒ d  S(   NR   R   R*   R+   R,   R-   R.   R/   R0   g      à?(   R   R   R   R   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_probplot_pltkwargs^   s
    (   t   __name__t
   __module__R   t   pytestt   markt
   matplotlibR   R   R   R   R    R!   R"   R#   R$   R'   R(   R)   R1   R2   R3   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR      s    		t   TestProbPlotLongelyc           B   s   e  Z d  „  Z RS(   c         C   s·   t  j j d ƒ t j j j d t ƒ |  _ t j	 |  j j
 d t ƒ|  j _
 t j |  j j |  j j
 ƒ j ƒ  |  _ t j |  j j t j d d ƒ|  _ d |  _ t t |  ƒ j ƒ  d  S(   Ni   t	   as_pandast   prependt   distargsi   t   r(   i   (   R	   R
   t   seedR   t   datasetst   longleyt   loadt   FalseR   t   add_constantt   exogt   OLSt   endogt   fitt   mod_fitR   t   residR    t   tR   R   t   superR9   R   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   h   s    !'$	(   R4   R5   R   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR9   g   s   t   TestProbPlotRandomNormalMinimalc           B   s   e  Z d  „  Z RS(   c         C   si   t  j j d ƒ t  j j d d d d d d ƒ |  _ t j |  j ƒ |  _ d  |  _	 t
 t |  ƒ j ƒ  d  S(   Ni   t   locg     € @t   scaleg      
@R   i%   (   R	   R
   R>   R   R   R   R   R   t   NoneR   RK   RL   R   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   s   s
    $	(   R4   R5   R   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyRL   r   s   t   TestProbPlotRandomNormalWithFitc           B   s   e  Z d  „  Z RS(   c         C   so   t  j j d ƒ t  j j d d d d d d ƒ |  _ t j |  j d t ƒ|  _ d	 |  _	 t
 t |  ƒ j ƒ  d  S(
   Ni   RM   g     € @RN   g      
@R   i%   RG   t   q(   R	   R
   R>   R   R   R   R   t   TrueR   R   RK   RP   R   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   |   s
    $	(   R4   R5   R   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyRP   {   s   t    TestProbPlotRandomNormalLocScalec           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   su   t  j j d ƒ t  j j d d d d d d ƒ |  _ t j |  j d d d d ƒ|  _ d |  _ t	 t
 |  ƒ j ƒ  d  S(	   Ni   RM   g     € @RN   g      
@R   i%   t   45(   R	   R
   R>   R   R   R   R   R   R   RK   RS   R   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   …   s
    $!	c         C   s   |  j  j d k s t ‚ d  S(   Ng     € @(   R   RM   t   AssertionError(   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_loc_setŒ   s    c         C   s   |  j  j d k s t ‚ d  S(   Ng      
@(   R   RN   RU   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_scale_set   s    (   R4   R5   R   RV   RW   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyRS   „   s   		t   TestCompareSamplesDifferentSizec           B   s;   e  Z d  „  Z e j j d „  ƒ Z e j j d „  ƒ Z RS(   c         C   sn   t  j j d ƒ t j t  j j d d d d d d ƒ ƒ |  _ t j t  j j d d d d d d ƒ ƒ |  _ d  S(	   Ni   RM   g     € @RN   g      
@R   i%   i7   (   R	   R
   R>   R   R   R   t   data1t   data2(   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   ”   s
    c         C   sF   |  j  j d |  j ƒ t j t ƒ  |  j j d |  j  ƒ Wd  QXd  S(   NR   (   RY   R   RZ   R6   t   raisest
   ValueError(   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   ›   s    c         C   s0   |  j  j d |  j ƒ |  j j d |  j  ƒ d  S(   NR   (   RY   R   RZ   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   ¡   s    (   R4   R5   R   R6   R7   R8   R   R   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyRX   “   s   	t$   TestProbPlotRandomNormalLocScaleDistc           B   s5   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   su   t  j j d ƒ t  j j d d d d d d ƒ |  _ t j |  j d d d d	 ƒ|  _ d
 |  _ t	 t
 |  ƒ j ƒ  d  S(   Ni   RM   g     € @RN   g      
@R   i%   i   i   RT   (   R	   R
   R>   R   R   R   R   R   R   RK   R]   R   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   ©   s
    $!	c         C   s   |  j  j d k s t ‚ d  S(   Ni   (   R   RM   RU   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyRV   °   s    c         C   s   |  j  j d k s t ‚ d  S(   Ni   (   R   RN   RU   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyRW   ³   s    c         C   s"   |  j  j j ƒ  d k s t ‚ d  S(   Ng       @(   R   t   distt   meanRU   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_loc_set_in_dist¶   s    c         C   s"   |  j  j j ƒ  d k s t ‚ d  S(   Ng      "@(   R   R^   t   varRU   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_scale_set_in_dist¹   s    (   R4   R5   R   RV   RW   R`   Rb   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR]   §   s
   				t   TestTopLevelc           B   se   e  Z d  „  Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z e j j d „  ƒ Z	 RS(   c         C   sÐ   t  j j j d t ƒ |  _ t  j |  j j d t ƒ|  j _ t  j |  j j	 |  j j ƒ j
 ƒ  |  _ |  j j |  _ t  j |  j j t j d d ƒ|  _ t j j d |  j j j ƒ |  _ t  j |  j ƒ |  _ d  S(   NR:   R;   R<   i   R   (   i   (   R   R?   R@   RA   RB   R   RC   RD   RE   RF   RG   RH   RI   t   resR   R    RJ   R   R	   R
   R   R   R   R   (   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   ¾   s    !'$!c         C   s   t  j |  j d d ƒd  S(   NR   R=   (   R   R   Rd   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR   Ç   s    c         C   s2   t  j |  j d d d d d d d d d	 d
 ƒd  S(   NR   R=   R*   R+   R,   R-   R.   R/   R0   g      à?(   R   R   Rd   (   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyR1   Ë   s    c         C   s=   x6 d d d d g D]" } t  j |  j |  j d | ƒq Wd  S(   NR=   RQ   RT   t   sR   (   R   t   qqplot_2samplesR   R   (   R   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt$   test_qqplot_2samples_ProbPlotObjectsÒ   s    c         C   s=   x6 d d d d g D]" } t  j |  j |  j d | ƒq Wd  S(   NR=   RQ   RT   Re   R   (   R   Rf   Rd   R   (   R   R   R   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_qqplot_2samples_arraysÚ   s    (
   R4   R5   R   R6   R7   R8   R   R1   Rg   Rh   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyRc   ½   s
   		c         C   s   t  j j d ƒ t j j j d t ƒ } t j | j	 d t ƒ| _	 t j
 | j | j	 ƒ j ƒ  } t j t d d ƒ! t j | j t j d d
 ƒWd  QXd  S(   Ni   R:   R;   t   matchs   dist\(0, 1, 4, loc=0, scale=1\)R<   i    i   i   (   i    i   i   (   R	   R
   R>   R   R?   R@   RA   RB   RC   RD   RE   RF   RG   R6   R[   t	   TypeErrorR   RI   R    RJ   (   R   R   RH   (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   test_invalid_dist_configâ   s    (   t   numpyR	   R6   t   scipyR    t   statsmodels.apit   apiR   t   objectR   R9   RL   RP   RS   RX   R]   Rc   Rk   (    (    (    sG   lib/python2.7/site-packages/statsmodels/graphics/tests/test_gofplots.pyt   <module>   s   _		%