ó
î&]\c           @` s  d  d l  m Z m Z m Z d  d l Z d  d l m Z d  d l m Z d d d d d	 g Z	 d
 d d d d g Z
 e e	 d d d … ƒ Z e e
 d d d … ƒ Z d „  Z d d d d d g Z d
 d d d d g Z e e d d d … ƒ Z e e d d d … ƒ Z d „  Z d S(   i    (   t   divisiont   print_functiont   absolute_importN(   t   poly1d(   t   betagÓSb¦Q
@gŸo€|-aç?g_3
L¶/á¿g†|úA"Æ?gCÜUÑG˜¿g      ð?g<ŽŸ*x@gÿÍ y’¼@g`B{dêAü?g-¡~éëÐ?iÿÿÿÿc   
      C` s4  t  j |  ƒ }  |  j } t  j |  ƒ j t  j ƒ }  d } |  d k  } |  d k } t  j |  ƒ | k  } | | B| B} |  | } |  | } t  j |  ƒ }	 t  j |	 | <t  j	 |	 | <| j
 d k rÞ t | ƒ t | ƒ |	 | <n  | j
 d k r'd | d d d d | t | d | d ƒ |	 | <n  | |	 _ |	 S(   só  Variance of the Tukey Lambda distribution.

    Parameters
    ----------
    lam : array_like
        The lambda values at which to compute the variance.

    Returns
    -------
    v : ndarray
        The variance.  For lam < -0.5, the variance is not defined, so
        np.nan is returned.  For lam = 0.5, np.inf is returned.

    Notes
    -----
    In an interval around lambda=0, this function uses the [4,4] Pade
    approximation to compute the variance.  Otherwise it uses the standard
    formula (https://en.wikipedia.org/wiki/Tukey_lambda_distribution).  The
    Pade approximation is used because the standard formula has a removable
    discontinuity at lambda = 0, and does not produce accurate numerical
    results near lambda = 0.
    g333333³?g      à¿i    g       @i   g      ð?i   (   t   npt   asarrayt   shapet
   atleast_1dt   astypet   float64t   abst
   empty_liket   nant   inft   sizet   _tukeylambda_var_pt   _tukeylambda_var_qR   (
   t   lamt   shpt	   thresholdt   low_maskt   neghalf_maskt
   small_maskt   reg_maskt   smallt   regt   v(    (    s=   lib/python2.7/site-packages/scipy/stats/_tukeylambda_stats.pyt   tukeylambda_variance-   s(    	

 	g333333ó?g6|ýÃòiÀgeÛSH§6ÀgÑí™˜^Ê?gË)kPd@g?…Ý»A¯@gID@êî)@g¢€¤Pr‘Û?g`2Ž¿fQÀc         C` sŽ  t  j |  ƒ }  |  j } t  j |  ƒ j t  j ƒ }  d } |  d k  } |  d k } t  j |  ƒ | k  } | | B| B} |  | } |  | } t  j |  ƒ }	 t  j |	 | <t  j	 |	 | <| j
 d k rÞ t | ƒ t | ƒ |	 | <n  | j
 d k rd d | d d t d | d | d ƒ d t d | d d | d ƒ }
 d d d | d t | d | d ƒ d } |
 | d |	 | <n  | |	 _ |	 S(	   sR  Kurtosis of the Tukey Lambda distribution.

    Parameters
    ----------
    lam : array_like
        The lambda values at which to compute the variance.

    Returns
    -------
    v : ndarray
        The variance.  For lam < -0.25, the variance is not defined, so
        np.nan is returned.  For lam = 0.25, np.inf is returned.

    g)\Âõ(¬?g      Ð¿i    g      ð?i   i   i   i   (   R   R   R   R   R	   R
   R   R   R   R   R   t   _tukeylambda_kurt_pt   _tukeylambda_kurt_qR   (   R   R   R   R   t   negqrtr_maskR   R   R   R   t   kt   numert   denom(    (    s=   lib/python2.7/site-packages/scipy/stats/_tukeylambda_stats.pyt   tukeylambda_kurtosis•   s,    	

,$/	(   t
   __future__R    R   R   t   numpyR   R   t   scipy.specialR   t   _tukeylambda_var_pct   _tukeylambda_var_qcR   R   R   t   _tukeylambda_kurt_pct   _tukeylambda_kurt_qcR   R   R#   (    (    (    s=   lib/python2.7/site-packages/scipy/stats/_tukeylambda_stats.pyt   <module>   s$   			]		