§
    fŠtjê?  ã                   óº   — d Z g d¢ZddlZddlmZmZ ddlmZ ddlmZ ddl	m
Z ddlmZmZmZmZ dd„Zdd„Zdd„Z	 	 dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„ZdS ) zB
Additional statistics functions with support for masked arrays.

)
Úcompare_medians_msÚhdquantilesÚhdmedianÚhdquantiles_sdÚidealfourthsÚmedian_cihsÚmjciÚmquantiles_cimjÚrshÚtrimmed_mean_cié    N)Úfloat64Úndarray)ÚMaskedArrayé   )Ú_mstats_basic)ÚnormÚbetaÚtÚbinom©g      Ð?ç      à?g      è?Fc                 ób  — d„ }t          j        | dt          ¬¦  «        } t          j        t          j        |¦  «        ¦  «        }|�| j        dk    r || ||¦  «        }n:| j        dk    rt          d| j        › �¦  «        ‚t          j        ||| ||¦  «        }t          j	        |d¬¦  «        S )	a$  
    Computes quantile estimates with the Harrell-Davis method.

    The quantile estimates are calculated as a weighted linear combination
    of order statistics.

    Parameters
    ----------
    data : array_like
        Data array.
    prob : sequence, optional
        Sequence of probabilities at which to compute the quantiles.
    axis : int or None, optional
        Axis along which to compute the quantiles. If None, use a flattened
        array.
    var : bool, optional
        Whether to return the variance of the estimate.

    Returns
    -------
    hdquantiles : MaskedArray
        A (p,) array of quantiles (if `var` is False), or a (2,p) array of
        quantiles and variances (if `var` is True), where ``p`` is the
        number of quantiles.

    See Also
    --------
    hdquantiles_sd

    Examples
    --------
    >>> import numpy as np
    >>> from scipy.stats.mstats import hdquantiles
    >>>
    >>> # Sample data
    >>> data = np.array([1.2, 2.5, 3.7, 4.0, 5.1, 6.3, 7.0, 8.2, 9.4])
    >>>
    >>> # Probabilities at which to compute quantiles
    >>> probabilities = [0.25, 0.5, 0.75]
    >>>
    >>> # Compute Harrell-Davis quantile estimates
    >>> quantile_estimates = hdquantiles(data, prob=probabilities)
    >>>
    >>> # Display the quantile estimates
    >>> for i, quantile in enumerate(probabilities):
    ...     print(f"{int(quantile * 100)}th percentile: {quantile_estimates[i]}")
    25th percentile: 3.1505820231763066 # may vary
    50th percentile: 5.194344084883956
    75th percentile: 7.430626414674935

    c                 óN  — t          j        t          j        |                      ¦   «                              t
          ¦  «        ¦  «        ¦  «        }|j        }t          j        dt          |¦  «        ft          ¦  «        }|dk     rt           j
        |_        |r|S |d         S t          j        |dz   ¦  «        t          |¦  «        z  }t          j        }t!          |¦  «        D ]r\  }}	 |||dz   |	z  |dz   d|	z
  z  ¦  «        }
|
dd…         |
dd…         z
  }t          j        ||¦  «        }||d|f<   t          j        |||z
  dz  ¦  «        |d|f<   Œs|d         |d|dk    f<   |d         |d|dk    f<   |r"t           j
        x|d|dk    f<   |d|dk    f<   |S |d         S )zGComputes the HD quantiles for a 1D array. Returns nan for invalid data.é   r   r   Néÿÿÿÿ)ÚnpÚsqueezeÚsortÚ
compressedÚviewr   ÚsizeÚemptyÚlenr   ÚnanÚflatÚarangeÚfloatr   ÚcdfÚ	enumerateÚdot)ÚdataÚprobÚvarÚxsortedÚnÚhdÚvÚbetacdfÚiÚpÚ_wÚwÚhd_means                úX/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/stats/_mstats_extras.pyÚ_hd_1Dzhdquantiles.<locals>._hd_1DP   s¤  € å”*�RœW T§_¢_Ñ%6Ô%6×%;Ò%;½GÑ%DÔ%DÑEÔEÑFÔFˆàŒLˆåŒX�q�˜T™œ�m¥WÑ-Ô-ˆØˆqŠ5ˆ5Ý”fˆBŒGØð Ø�	Ø�a”5ˆLåŒI�a˜‘c‰NŒN�U 1™XœXÑ%ˆÝ”(ˆÝ˜t‘_”_ð 	6ð 	6‰EˆQˆqØ�˜˜Q˜q™S !™G a¨¡c¨A¨a©C¡[Ñ1Ô1ˆBØ�1�2�2”˜˜C˜R˜CœÑ ˆAÝ”f˜Q Ñ(Ô(ˆGØˆBˆq�ˆs‰Gå”f˜Q ¨¡°1Ñ 4Ñ5Ô5ˆBˆq�ˆs‰GˆGà" 1œ:ˆˆ1ˆd�aŠiˆ<ÑØ" 2œ;ˆˆ1ˆd�aŠiˆ<ÑØð 	Ý24´&Ð8ˆBˆq�$˜!’)ˆ|Ñ˜r ! T¨Q¢Y ,Ñ/ØˆIØ�!Œuˆó    F©ÚcopyÚdtypeNr   r   úBArray 'data' must be at most two dimensional, but got data.ndim = ©r<   )
ÚmaÚarrayr   r   Ú
atleast_1dÚasarrayÚndimÚ
ValueErrorÚapply_along_axisÚfix_invalid)r+   r,   Úaxisr-   r9   r4   Úresults          r8   r   r      sË   € ðhð ð õ< Œ8�D˜u­GÐ4Ñ4Ô4€DÝ
Œ•b”j Ñ&Ô&Ñ'Ô'€Aàˆ˜$œ) qš.˜.Ø�˜˜a Ñ%Ô%ˆˆàŒ9�qŠ=ˆ=Ýð @Ø48´Ið@ð @ñ Aô Að AåÔ$ V¨T°4¸¸CÑ@Ô@ˆåŒ>˜& uÐ-Ñ-Ô-Ð-r:   r   c                 óR   — t          | dg||¬¦  «        }|                     ¦   «         S )a9  
    Returns the Harrell-Davis estimate of the median along the given axis.

    Parameters
    ----------
    data : ndarray
        Data array.
    axis : int, optional
        Axis along which to compute the quantiles. If None, use a flattened
        array.
    var : bool, optional
        Whether to return the variance of the estimate.

    Returns
    -------
    hdmedian : MaskedArray
        The median values.  If ``var=True``, the variance is returned inside
        the masked array.  E.g. for a 1-D array the shape change from (1,) to
        (2,).

    r   )rH   r-   )r   r   )r+   rH   r-   rI   s       r8   r   r   |   s,   € õ, ˜˜s˜e¨$°CÐ8Ñ8Ô8€FØ�>Š>ÑÔÐr:   c                 ól  — d„ }t          j        | dt          ¬¦  «        } t          j        t          j        |¦  «        ¦  «        }|€ || |¦  «        }n9| j        dk    rt          d| j        › �¦  «        ‚t          j        ||| |¦  «        }t          j	        |d¬¦  «         
                    ¦   «         S )aý  
    The standard error of the Harrell-Davis quantile estimates by jackknife.

    Parameters
    ----------
    data : array_like
        Data array.
    prob : sequence, optional
        Sequence of quantiles to compute.
    axis : int, optional
        Axis along which to compute the quantiles. If None, use a flattened
        array.

    Returns
    -------
    hdquantiles_sd : MaskedArray
        Standard error of the Harrell-Davis quantile estimates.

    See Also
    --------
    hdquantiles

    c                 ó$  — t          j        |                      ¦   «         ¦  «        }t          |¦  «        }t          j        t          |¦  «        t
          ¦  «        }|dk     rt           j        |_        t          j        |¦  «        t          |dz
  ¦  «        z  }t          j        }t          |¦  «        D ]Ù\  }} ||||z  |d|z
  z  ¦  «        }	|	dd…         |	dd…         z
  }
t          j        |¦  «        }t          j        |
|dd…         z  ¦  «        |dd…<   |dd…xx         t          j        |
ddd…         |ddd…         z  ¦  «        ddd…         z  cc<   t          j        |                     ¦   «         |dz
  z  ¦  «        ||<   ŒÚ|S )z%Computes the std error for 1D arrays.r   r   Nr   r   )r   r   r   r#   r"   r   r$   r%   r&   r'   r   r(   r)   Ú
zeros_likeÚcumsumÚsqrtr-   )r+   r,   r.   r/   ÚhdsdÚvvr2   r3   r4   r5   r6   Úmx_s               r8   Ú_hdsd_1Dz hdquantiles_sd.<locals>._hdsd_1D®   sl  € å”'˜$Ÿ/š/Ñ+Ô+Ñ,Ô,ˆÝ�‰LŒLˆåŒx�˜D™	œ	¥7Ñ+Ô+ˆØˆqŠ5ˆ5ÝœˆDŒIåŒY�q‰\Œ\�E ! A¡#™JœJÑ&ˆÝ”(ˆå˜t‘_”_ð 		3ð 		3‰EˆQˆqØ�˜˜Q˜q™S ! Q q¡S¡'Ñ*Ô*ˆBØ�1�2�2”˜˜C˜R˜CœÑ ˆAõ ”- Ñ(Ô(ˆCÝ”i  G¨C¨R¨C¤LÑ 0Ñ1Ô1ˆC���‰Gà���ˆHˆHŒH�œ	 ! D D b D¤'¨G°E°Q°r°E¬NÑ":Ñ;Ô;¸D¸D¸b¸DÔAÑAˆHˆH‰HÝ”g˜cŸgšg™iœi¨1¨q©5Ñ1Ñ2Ô2ˆD�‰GˆGØˆr:   Fr;   Nr   r>   r?   )r@   rA   r   r   rB   rC   rD   rE   rF   rG   Úravel)r+   r,   rH   rS   r4   rI   s         r8   r   r   –   sÈ   € ð0ð ð õ2 Œ8�D˜u­GÐ4Ñ4Ô4€DÝ
Œ•b”j Ñ&Ô&Ñ'Ô'€AàˆØ�˜$ Ñ"Ô"ˆˆàŒ9�qŠ=ˆ=Ýð @Ø48´Ið@ð @ñ Aô Að AåÔ$ X¨t°T¸1Ñ=Ô=ˆåŒ>˜& uÐ-Ñ-Ô-×3Ò3Ñ5Ô5Ð5r:   ©çš™™™™™É?rV   ©TTçš™™™™™©?c                 ób  — t          j        | d¬¦  «        } t          j        | |||¬¦  «        }|                     |¦  «        }t          j        | |||¬¦  «        }|                     |¦  «        dz
  }t          j        d|dz  z
  |¦  «        }	t          j        ||	|z  z
  ||	|z  z   f¦  «        S )a³  
    Selected confidence interval of the trimmed mean along the given axis.

    Parameters
    ----------
    data : array_like
        Input data.
    limits : {None, tuple}, optional
        None or a two item tuple.
        Tuple of the percentages to cut on each side of the array, with respect
        to the number of unmasked data, as floats between 0. and 1. If ``n``
        is the number of unmasked data before trimming, then
        (``n * limits[0]``)th smallest data and (``n * limits[1]``)th
        largest data are masked.  The total number of unmasked data after
        trimming is ``n * (1. - sum(limits))``.
        The value of one limit can be set to None to indicate an open interval.

        Defaults to (0.2, 0.2).
    inclusive : (2,) tuple of boolean, optional
        If relative==False, tuple indicating whether values exactly equal to
        the absolute limits are allowed.
        If relative==True, tuple indicating whether the number of data being
        masked on each side should be rounded (True) or truncated (False).

        Defaults to (True, True).
    alpha : float, optional
        Confidence level of the intervals.

        Defaults to 0.05.
    axis : int, optional
        Axis along which to cut. If None, uses a flattened version of `data`.

        Defaults to None.

    Returns
    -------
    trimmed_mean_ci : (2,) ndarray
        The lower and upper confidence intervals of the trimmed data.

    Fr?   )ÚlimitsÚ	inclusiverH   r   ç       @)
r@   rA   ÚmstatsÚtrimrÚmeanÚtrimmed_stdeÚcountr   Úppfr   )
r+   rZ   r[   ÚalpharH   ÚtrimmedÚtmeanÚtstdeÚdfÚtppfs
             r8   r   r   Õ   s±   € õT Œ8�D˜uÐ%Ñ%Ô%€DÝŒl˜4¨¸)È$ÐOÑOÔO€GØ�LŠL˜ÑÔ€EÝÔ ¨F¸YÈDÐQÑQÔQ€EØ	�Š�tÑ	Ô	˜qÑ	 €BÝŒ5��5˜‘8‘˜BÑÔ€DÝŒ8�U˜T %™ZÑ'¨¨t°E©zÑ)9Ð:Ñ;Ô;Ð;r:   c                 ó  — d„ }t          j        | d¬¦  «        } | j        dk    rt          d| j        › �¦  «        ‚t	          j        t	          j        |¦  «        ¦  «        }|€ || |¦  «        S t          j        ||| |¦  «        S )a„  
    Returns the Maritz-Jarrett estimators of the standard error of selected
    experimental quantiles of the data.

    Parameters
    ----------
    data : ndarray
        Data array.
    prob : sequence, optional
        Sequence of quantiles to compute.
    axis : int or None, optional
        Axis along which to compute the quantiles. If None, use a flattened
        array.

    c                 óŠ  — t          j        |                      ¦   «         ¦  «        } | j        }t          j        |¦  «        |z  dz                        t          ¦  «        }t          j        }t          j	        t          |¦  «        t          ¦  «        }t          j        d|dz   t          ¬¦  «        |z  }|d|z  z
  }t          |¦  «        D ]v\  }}	 |||	dz
  ||	z
  ¦  «         |||	dz
  ||	z
  ¦  «        z
  }
t          j        |
| ¦  «        }t          j        |
| dz  ¦  «        }t          j        ||dz  z
  ¦  «        ||<   Œw|S )Nr   r   )r=   g      ð?r   )r   r   r   r!   rA   ÚastypeÚintr   r(   r"   r#   r   r&   r)   r*   rO   )r+   r4   r/   r,   r2   ÚmjÚxÚyr3   ÚmÚWÚC1ÚC2s                r8   Ú_mjci_1Dzmjci.<locals>._mjci_1D  s%  € ÝŒw�t—’Ñ(Ô(Ñ)Ô)ˆØŒIˆÝ”˜‘”˜a‘ #Ñ%×-Ò-­cÑ2Ô2ˆÝ”(ˆåŒX•c˜$‘i”i¥Ñ)Ô)ˆÝŒI�a˜˜!™¥7Ð+Ñ+Ô+¨aÑ/ˆØ��1‘‰HˆÝ˜t‘_”_ð 	(ð 	(‰EˆQˆqØ�˜˜!˜A™#˜a ™cÑ"Ô" W W¨Q¨q°©s°1°Q±3Ñ%7Ô%7Ñ7ˆAÝ”˜˜$‘”ˆBÝ”˜˜$ ™'Ñ"Ô"ˆBÝ”G˜B  Q¡™JÑ'Ô'ˆBˆq‰EˆEØˆ	r:   Fr?   r   r>   )r@   rA   rD   rE   r   rB   rC   rF   )r+   r,   rH   rt   r4   s        r8   r   r     s¡   € ð ð ð õ  Œ8�D˜uÐ%Ñ%Ô%€DØ„y�1‚}€}Ýð <Ø04´	ð<ð <ñ =ô =ð 	=õ 	Œ•b”j Ñ&Ô&Ñ'Ô'€AàˆØˆx˜˜aÑ Ô Ð åÔ" 8¨T°4¸Ñ;Ô;Ð;r:   c                 óÒ   — t          |d|z
  ¦  «        }t          j        d|dz  z
  ¦  «        }t          j        | |dd|¬¦  «        }t          | ||¬¦  «        }|||z  z
  |||z  z   fS )aÕ  
    Computes the alpha confidence interval for the selected quantiles of the
    data, with Maritz-Jarrett estimators.

    Parameters
    ----------
    data : ndarray
        Data array.
    prob : sequence, optional
        Sequence of quantiles to compute.
    alpha : float, optional
        Confidence level of the intervals.
    axis : int or None, optional
        Axis along which to compute the quantiles.
        If None, use a flattened array.

    Returns
    -------
    ci_lower : ndarray
        The lower boundaries of the confidence interval.  Of the same length as
        `prob`.
    ci_upper : ndarray
        The upper boundaries of the confidence interval.  Of the same length as
        `prob`.

    r   r\   r   )ÚalphapÚbetaprH   ©rH   )Úminr   rb   r]   Ú
mquantilesr   )r+   r,   rc   rH   ÚzÚxqÚsmjs          r8   r	   r	   5  sx   € õ6 ��q˜5‘yÑ!Ô!€EÝŒ��U˜2‘X‘ÑÔ€AÝ	Ô	˜4 ¨a°q¸tÐ	DÑ	DÔ	D€BÝ
ˆt�T Ð
%Ñ
%Ô
%€CØ��S‘‰L˜"˜q 3™w™,Ð'Ð'r:   c                 óÈ   — d„ }t          j        | d¬¦  «        } |€ || |¦  «        }n9| j        dk    rt          d| j        › �¦  «        ‚t          j        ||| |¦  «        }|S )aA  
    Computes the alpha-level confidence interval for the median of the data.

    Uses the Hettmasperger-Sheather method.

    Parameters
    ----------
    data : array_like
        Input data. Masked values are discarded. The input should be 1D only,
        or `axis` should be set to None.
    alpha : float, optional
        Confidence level of the intervals.
    axis : int or None, optional
        Axis along which to compute the quantiles. If None, use a flattened
        array.

    Returns
    -------
    median_cihs
        Alpha level confidence interval.

    c                 ó  — t          j        |                      ¦   «         ¦  «        } t          | ¦  «        }t	          |d|z
  ¦  «        }t          t          j        |dz  |d¦  «        ¦  «        }t          j        ||z
  |d¦  «        t          j        |dz
  |d¦  «        z
  }|d|z
  k     r8|dz  }t          j        ||z
  |d¦  «        t          j        |dz
  |d¦  «        z
  }t          j        ||z
  dz
  |d¦  «        t          j        ||d¦  «        z
  }|dz
  |z   ||z
  z  }||z
  |z  t          ||d|z  z
  |z  z   ¦  «        z  }|| |         z  d|z
  | |dz
           z  z   || ||z
  dz
           z  d|z
  | ||z
           z  z   f}|S )Nr   r\   r   r   )
r   r   r   r#   ry   rl   r   Ú_ppfr(   r'   )	r+   rc   r/   ÚkÚgkÚgkkÚIÚlambdÚlimss	            r8   Ú_cihs_1Dzmedian_cihs.<locals>._cihs_1Dn  s�  € ÝŒw�t—’Ñ(Ô(Ñ)Ô)ˆÝ�‰IŒIˆÝ�E˜1˜U™7Ñ#Ô#ˆÝ•”
˜5 ™8 Q¨Ñ,Ô,Ñ-Ô-ˆÝŒY�q˜‘s˜1˜SÑ!Ô!¥E¤I¨a°©c°!°CÑ$8Ô$8Ñ8ˆØ��%‘Š<ˆ<Ø�‰FˆAÝ”˜1˜Q™3˜q Ñ%Ô%­¬	°!°A±#°a¸Ñ(<Ô(<Ñ<ˆBÝŒi˜˜!™˜A™˜a Ñ$Ô$¥u¤y°°1°SÑ'9Ô'9Ñ9ˆØ�!‰V�e‰^˜b 3™hÑ'ˆØ�1‘˜‘	�E ! q¨¨1©¡u¨a¡i¡-Ñ0Ô0Ñ0ˆØ�d˜1”g‘  5¡¨$¨q°©s¬)Ñ 3Ñ3Ø�d˜1˜Q™3˜q™5”kÑ! Q u¡W¨d°1°Q±3¬iÑ$7Ñ7ð9ˆàˆr:   Fr?   Nr   r>   )r@   rA   rD   rE   rF   )r+   rc   rH   r‡   rI   s        r8   r   r   W  s‘   € ð.ð ð õ Œ8�D˜uÐ%Ñ%Ô%€DàˆØ�˜$ Ñ&Ô&ˆˆàŒ9�qŠ=ˆ=Ýð @Ø48´Ið@ð @ñ Aô Að AåÔ$ X¨t°T¸5ÑAÔAˆà€Mr:   c                 óJ  — t          j        | |¬¦  «        t          j        ||¬¦  «        }}t          j        | |¬¦  «        t          j        ||¬¦  «        }}t	          j        ||z
  ¦  «        t          j        |dz  |dz  z   ¦  «        z  }dt          j        |¦  «        z
  S )a"  
    Compares the medians from two independent groups along the given axis.

    The comparison is performed using the McKean-Schrader estimate of the
    standard error of the medians.

    Parameters
    ----------
    group_1 : array_like
        First dataset.  Has to be of size >=7.
    group_2 : array_like
        Second dataset.  Has to be of size >=7.
    axis : int, optional
        Axis along which the medians are estimated. If None, the arrays are
        flattened.  If `axis` is not None, then `group_1` and `group_2`
        should have the same shape.

    Returns
    -------
    compare_medians_ms : {float, ndarray}
        If `axis` is None, then returns a float, otherwise returns a 1-D
        ndarray of floats with a length equal to the length of `group_1`
        along `axis`.

    Examples
    --------

    >>> from scipy import stats
    >>> a = [1, 2, 3, 4, 5, 6, 7]
    >>> b = [8, 9, 10, 11, 12, 13, 14]
    >>> stats.mstats.compare_medians_ms(a, b, axis=None)
    1.0693225866553746e-05

    The function is vectorized to compute along a given axis.

    >>> import numpy as np
    >>> rng = np.random.default_rng()
    >>> x = rng.random(size=(3, 7))
    >>> y = rng.random(size=(3, 8))
    >>> stats.mstats.compare_medians_ms(x, y, axis=1)
    array([0.36908985, 0.36092538, 0.2765313 ])

    References
    ----------
    .. [1] McKean, Joseph W., and Ronald M. Schrader. "A comparison of methods
       for studentizing the sample median." Communications in
       Statistics-Simulation and Computation 13.6 (1984): 751-773.

    rx   r   r   )	r@   Úmedianr]   Ústde_medianr   ÚabsrO   r   r(   )Úgroup_1Úgroup_2rH   Úmed_1Úmed_2Ústd_1Ústd_2rq   s           r8   r   r   Š  sš   € õd ”i ¨TÐ2Ñ2Ô2µB´I¸gÈ4Ð4PÑ4PÔ4PˆE€UÝÔ(¨°tÐ<Ñ<Ô<ÝÔ(¨°tÐ<Ñ<Ô<ð €Uå
Œˆu�u‰}ÑÔ¥¤¨¨q©°5¸!±8Ñ(;Ñ <Ô <Ñ<€AØ�tŒx˜‰{Œ{‰?Ðr:   c                 óª   — d„ }t          j        | |¬¦  «                             t          ¦  «        } |€ || ¦  «        S t          j        ||| ¦  «        S )aC  
    Returns an estimate of the lower and upper quartiles.

    Uses the ideal fourths algorithm.

    Parameters
    ----------
    data : array_like
        Input array.
    axis : int, optional
        Axis along which the quartiles are estimated. If None, the arrays are
        flattened.

    Returns
    -------
    idealfourths : {list of floats, masked array}
        Returns the two internal values that divide `data` into four parts
        using the ideal fourths algorithm either along the flattened array
        (if `axis` is None) or along `axis` of `data`.

    c                 óZ  — |                       ¦   «         }t          |¦  «        }|dk     rt          j        t          j        gS t	          |dz  dz   d¦  «        \  }}t          |¦  «        }d|z
  ||dz
           z  |||         z  z   }||z
  }d|z
  ||         z  |||dz
           z  z   }||gS )Né   g      @g«ªªªªªÚ?r   )r   r#   r   r$   Údivmodrl   )r+   rn   r/   ÚjÚhÚqlor�   Úqups           r8   Ú_idfzidealfourths.<locals>._idfÙ  s°   € Ø�OŠOÑÔˆÝ�‰FŒFˆØˆqŠ5ˆ5Ý”F�2œ6�?Ð"Ý�q˜‘t˜e‘| AÑ&Ô&‰ˆˆ1Ý�‰FŒFˆØ�‰s�A�a˜‘c”F‰l˜Q˜q œt™VÑ#ˆØ�‰EˆØ�‰s�A�a”D‰j˜1˜Q˜q ™sœV™8Ñ#ˆØ�SˆzÐr:   rx   )r@   r   r    r   rF   )r+   rH   rš   s      r8   r   r   Ã  s]   € ð,
ð 
ð 
õ Œ7�4˜dÐ#Ñ#Ô#×(Ò(­Ñ5Ô5€DØˆØˆt�D‰zŒzÐåÔ" 4¨¨tÑ4Ô4Ð4r:   c                 ó  — t          j        | d¬¦  «        } |€| }n&t          j        t          j        |¦  «        ¦  «        }| j        dk    rt          d¦  «        ‚|                      ¦   «         }t          | d¬¦  «        }d|d         |d	         z
  z  |d
z  z  }| dd…df         |ddd…f         |z   k     	                    d	¦  «        }| dd…df         |ddd…f         |z
  k      	                    d	¦  «        }||z
  d|z  |z  z  S )aé  
    Evaluates Rosenblatt's shifted histogram estimators for each data point.

    Rosenblatt's estimator is a centered finite-difference approximation to the
    derivative of the empirical cumulative distribution function.

    Parameters
    ----------
    data : sequence
        Input data, should be 1-D. Masked values are ignored.
    points : sequence or None, optional
        Sequence of points where to evaluate Rosenblatt shifted histogram.
        If None, use the data.

    Fr?   Nr   z#The input array should be 1D only !rx   g333333ó?r   r   rV   r\   )
r@   rA   r   rB   rC   rD   ÚAttributeErrorra   r   Úsum)r+   Úpointsr/   Úrr—   ÚnhiÚnlos          r8   r
   r
   ë  s  € õ  Œ8�D˜uÐ%Ñ%Ô%€DØ€~Øˆˆå”�rœz¨&Ñ1Ô1Ñ2Ô2ˆà„y�A‚~€~ÝÐBÑCÔCÐCà�
Š
‰Œ€AÝ�T Ð%Ñ%Ô%€AØˆq�Œu�Q�q”T‰zÑ˜Q ™YÑ&€AØ����$�Œ<˜6 $ q q q &œ>¨AÑ-Ò-×
2Ò
2°1Ñ
5Ô
5€CØ����$�Œ<˜&  a a a œ.¨1Ñ,Ò,×
1Ò
1°!Ñ
4Ô
4€CØ�‰G˜˜1™˜Q™ÑÐr:   )r   NF)r   F)r   N)rU   rW   rX   N)r   rX   N)rX   N)N)Ú__doc__Ú__all__Únumpyr   r   r   Únumpy.mar@   r   Ú r   r]   Úscipy.stats.distributionsr   r   r   r   r   r   r   r   r   r	   r   r   r   r
   © r:   r8   ú<module>r©      s‡  ððð ðð ð €ð Ð Ð Ð Ø "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  à %Ð %Ð %Ð %Ð %Ð %à :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :ð].ð ].ð ].ð ].ð@ð ð ð ð4<6ð <6ð <6ð <6ð~ 7BØ%)ð0<ð 0<ð 0<ð 0<ðf*<ð *<ð *<ð *<ðZ(ð (ð (ð (ðD0ð 0ð 0ð 0ðf6ð 6ð 6ð 6ðr%5ð %5ð %5ð %5ðP ð  ð  ð  ð  ð  r:   