+
    nDj6!                         ^ RI t^ RIHt ^ RIHt ^ RIHt ^ RIH	t
 ^ RIHtHtHtHt R tR t]! R.R	7      R
RR^ RR/R l4       tR# )    N)partial)stats)_broadcast_arrays)array_api_extra)xp_capabilitiesarray_namespacexp_ravelxp_result_typec           
        \        W4      pVP                  V 4      VP                  V4      r\        P                  ! V ^R7      \        P                  ! V^R7      rVRJ p\	        V P
                  VP
                  4      pV'       d   \        WR7      p \        WR7      p^ pMS\        P                  ! V4      '       g   \        V4      V8w  d   Rp\        V4      hW78  g   W7) 8  d   Rp\        V4      h\        V4      p\        W3W5R7      w  rV P                  R,          VP                  R,          rV	^8  g   V
^8  d   \        R4      hVP                  WR4      VP                  WR4      r\        P                  ! VP!                  W3RR7      RR7      pVP#                  V\%        WR	VR
7      4      pVRRV P                  R,          13,          VRV P                  R,          R13,          rVP                  V RV4      VP                  VRV4      r0 RmpVP'                  4       pW,9  d   \        RV R24      hVf   \        P(                  ! 4       MTp\+        V\        P(                  4      '       g   \        R4      hWW#WE3# )z1Input validation and standardization for bws test)ndimN)xpz"`axis` must be an integer or None.z7`axis` is not compatible with the shapes of the inputs.)axisr   z8`x` and `y` must contain at least two observations each.r   T)force_floatingr   .z`alternative` must be one of .z?`method` must be an instance of `scipy.stats.PermutationMethod`>   lessgreater	two-sided)r   asarrayxpx
atleast_ndmaxr   r	   npiterableint
ValueErrorr   shapemoveaxisr   rankdataconcatastyper
   lowerPermutationMethod
isinstance)xyalternativer   methodr   	axis_noner   messagenxnyzalternativess   &&&&&        O/data/cameron/venvs/s3viz/lib/python3.14/site-packages/scipy/stats/_bws_test.py_bws_input_validationr1      s$   		B::a="**Q-q>>!!$cnnQQ&?qIqvvqvvDQQ	T		c$i4/6!!
,D5LK!!t9DaV$6DAWWR[!''"+	AvaSTT;;q#R[["%=qryy!by1;A
		!^A"EFAS,1772;,3#4!5q;;q"d#R[[B%=q3L##%K&8aHII*0.U$$&fFfe5566 ; < 	< F..    c                J   VP                  WR7      VP                  WR7      reVP                  V,          VP                  V,          rVP                  ^V^,           VP                  R7      VP                  ^V^,           VP                  R7      rWXV,           V,          V	,          ,
          pWhV,           V,          V
,          ,
          pVR8X  dZ   \        P
                  ! V4      R,          P                  V4      p\        P
                  ! V4      R,          P                  V4      pMv\        P
                  ! V4      R,          P                  VP                  V4      4      p\        P
                  ! V4      R,          P                  VP                  V4      4      pW^,           ,          ^W^,           ,          ,
          ,          V,          W,           ,          V,          pW^,           ,          ^W^,           ,          ,
          ,          V,          W,           ,          V,          p^V,          VP                  W,          VR7      ,          p^V,          VP                  W,          VR7      ,          pVR8X  d   VV,           ^,          pV# VV,
          ^,          pV# )z:Compute the BWS test statistic for two independent samplesr   )dtyper   .)	sortr   aranger4   r   atmultiplyabssum)r&   r'   r(   r   r   RiHjnmijBx_numBy_numBx_denBy_denBxByBs   &&&&&             r0   _bws_statisticrH   7   s   
 WWQW"BGGAG$988D>288D>q99Q!2889,bii1Q3bhhi.Oqq5!)a-Fq5!)a-Fk!$--f5$--f5$--bffVn=$--bffVn=!WAsG$q(!#.q0F!WAsG$q(!#.q0F	
1rvvfm$v/	/B	
1rvvfm$v/	/B$3bAAH ;=r'QAHr2   )skip_backendsr(   r   r   r)   c                   \        WVW44      w  rr#rE\        \        W%R7      pVR8X  d   RMRp\        P                  ! W3V3RVRV/VP                  4       B pV# )u  Perform the Baumgartner-Weiss-Schindler test on two independent samples.

The Baumgartner-Weiss-Schindler (BWS) test is a nonparametric test of
the null hypothesis that the distribution underlying sample `x`
is the same as the distribution underlying sample `y`. Unlike
the Kolmogorov-Smirnov, Wilcoxon, and Cramer-Von Mises tests,
the BWS test weights the integral by the variance of the difference
in cumulative distribution functions (CDFs), emphasizing the tails of the
distributions, which increases the power of the test in many applications.

Parameters
----------
x, y : array-like
    Arrays of samples. Shapes must be broadcastable except along `axis`.
alternative : {'two-sided', 'less', 'greater'}, optional
    Defines the alternative hypothesis. Default is 'two-sided'.
    Let *F(u)* and *G(u)* be the cumulative distribution functions of the
    distributions underlying `x` and `y`, respectively. Then the following
    alternative hypotheses are available:

    * 'two-sided': the distributions are not equal, i.e. *F(u) ≠ G(u)* for
      at least one *u*.
    * 'less': the distribution underlying `x` is stochastically less than
      the distribution underlying `y`, i.e. *F(u) >= G(u)* for all *u*.
    * 'greater': the distribution underlying `x` is stochastically greater
      than the distribution underlying `y`, i.e. *F(u) <= G(u)* for all
      *u*.

    Under a more restrictive set of assumptions, the alternative hypotheses
    can be expressed in terms of the locations of the distributions;
    see [2] section 5.1.
axis : int or None, default: 0
    Axis along which the quantiles are computed.
    ``None`` ravels both `x` and `y` before performing the calculation.
method : PermutationMethod, optional
    Configures the method used to compute the p-value. The default is
    the default `PermutationMethod` object.

Returns
-------
res : PermutationTestResult
    An object with attributes:

    statistic : float
        The observed test statistic of the data.
    pvalue : float
        The p-value for the given alternative.
    null_distribution : ndarray
        The values of the test statistic generated under the null hypothesis.

See Also
--------
scipy.stats.wilcoxon, scipy.stats.mannwhitneyu, scipy.stats.ttest_ind

Notes
-----
When ``alternative=='two-sided'``, the statistic is defined by the
equations given in [1]_ Section 2. This statistic is not appropriate for
one-sided alternatives; in that case, the statistic is the *negative* of
that given by the equations in [1]_ Section 2. Consequently, when the
distribution of the first sample is stochastically greater than that of the
second sample, the statistic will tend to be positive.

References
----------
.. [1] Neuhäuser, M. (2005). Exact Tests Based on the
       Baumgartner-Weiss-Schindler Statistic: A Survey. Statistical Papers,
       46(1), 1-29.
.. [2] Fay, M. P., & Proschan, M. A. (2010). Wilcoxon-Mann-Whitney or t-test?
       On assumptions for hypothesis tests and multiple interpretations of
       decision rules. Statistics surveys, 4, 1.

Examples
--------
We follow the example of table 3 in [1]_: Fourteen children were divided
randomly into two groups. Their ranks at performing a specific tests are
as follows.

>>> import numpy as np
>>> x = [1, 2, 3, 4, 6, 7, 8]
>>> y = [5, 9, 10, 11, 12, 13, 14]

We use the BWS test to assess whether there is a statistically significant
difference between the two groups.
The null hypothesis is that there is no difference in the distributions of
performance between the two groups. We decide that a significance level of
1% is required to reject the null hypothesis in favor of the alternative
that the distributions are different.
Since the number of samples is very small, we can compare the observed test
statistic against the *exact* distribution of the test statistic under the
null hypothesis.

>>> from scipy.stats import bws_test
>>> res = bws_test(x, y)
>>> print(res.statistic)
5.132167152575315

This agrees with :math:`B = 5.132` reported in [1]_. The *p*-value produced
by `bws_test` also agrees with :math:`p = 0.0029` reported in [1]_.

>>> print(res.pvalue)
0.002913752913752914

Because the p-value is below our threshold of 1%, we take this as evidence
against the null hypothesis in favor of the alternative that there is a
difference in performance between the two groups.
)r(   r   r   r   r(   r   )r1   r   rH   r   permutation_test_asdict)	r&   r'   r(   r   r)   r   bws_statisticpermutation_alternativeress	   &&$$$    r0   bws_testrP   U   sv    \ +@k@D+N'A+VNKM(3v(=f9

 
 ! 5-D5KO5#)>>#35C Jr2   )z
dask.arrayzno rankdata)numpyr   	functoolsr   scipyr   scipy.stats._axis_nan_policyr   scipy._externalr   r   scipy._lib._array_apir   r   r	   r
   r1   rH   rP    r2   r0   <module>rX      sa       : 23 3)/X<  =>?v+ vA vd v @vr2   