+
    0ih                       ^ RI t ^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
HtHtHtHtHt ^ RIHtHt ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHt ^ R
IHtHtH t H!t! ^ RI"Hu H#t# ]! ]4       ! R R4      4       t$]! ]4       ! R R4      4       t%]! ]!4       ! R R4      4       t&]! ] 4       ! R R4      4       t'R t(]PR                  PU                  R. RO4      R 4       t+ ! R R4      t,R# )    N)assert_allcloseassert_equal)rng_integers)is_numpymake_xp_test_casexp_default_dtypexp_sizearray_namespace_xp_copy_to_numpy)xp_assert_closexp_assert_equal)array_api_extra)statsspecial)skip_xp_backends)root)	bootstrapmonte_carlo_testpermutation_testpowerc                   	  a  ] tR t^t o ]! RRR7      R 4       tR t]P                  P                  R. R>O4      ]P                  P                  R
. R?O4      R 4       4       t
]P                  P                  R. R>O4      R 4       t]P                  P                  R. R>O4      ]P                  P                  R
. R?O4      ]P                  P                  RRR.4      R 4       4       4       t]P                  P                  ]P                  P                  R4      ]P                  P                  R. R>O4      R 4       4       4       t. R@Ot]P                  P                  R]4      R 4       tR tR tRRRRR	R/t]P                  P                  ]P                  P                  R]P+                  4       4      R 4       4       tRRRR/t]P                  P                  ]P                  P                  R]P+                  4       4      R 4       4       t]P                  P                  R. R>O4      ]P                  P                  R
^ ^.4      ]P                  P                  RRR .4      R! 4       4       4       t]P                  P                  R"4      ]P                  P                  R. R>O4      ]P                  P                  R
^ ^.4      R# 4       4       4       t]P                  P                  R. R>O4      R$ 4       t]P                  P                  R. RAO4      R% 4       tR& t]P                  P                  R'^ R(.4      R) 4       t]P                  P                  R*4      ]P                  P                  R. R>O4      R+ 4       4       tR, t ]P                  P	                  R-R.R7      ]P                  P                  R/R0R1.4      R2 4       4       t!]P                  P                  R3. RBO4      ]P                  P                  R
. R?O4      R4 4       4       t"]P                  P                  R
. R?O4      R5 4       t#]P                  P                  ]P                  P                  R. R>O4      R6 4       4       t$]P                  P                  ]P                  PK                  R74      R8 4       4       t&]P                  P	                  RR9.R:7      R; 4       t'R<t(V t)R=# )CTestBootstrapnumpyzNumPy does not raisereasonc                   a R SP                    2p\        P                  ! \        VR7      ;_uu_ 4        \	        SP                  . RO4      3V3R l4       RRR4       R#   + '       g   i     R# ; i)zWhen using array library matchc                 &   < SP                  V 4      # Nmeanxxps   &_/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/stats/tests/test_resampling.py<lambda>7TestBootstrap.test_bootstrap_iv_other.<locals>.<lambda>   s    "''!*    N         )__name__pytestraises	TypeErrorr   asarray)selfr%   messages   &f r&   test_bootstrap_iv_other%TestBootstrap.test_bootstrap_iv_other   sJ    -bkk];]]9G44rzz),.0DE 5444s   #A""A3	c           	     
   VP                  . RO4      pRp\        P                  ! \        VR7      ;_uu_ 4        \	        \        4       VP                  4       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W!P                  ^.4      3VP                  4       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W!P                  . RO4      3VP                  RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W!P                  R	R
7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  R R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  R R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  R	R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  ^
R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  ^ R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        V3VP                  RR7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELQ; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELO; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELK; i  + '       g   i     R# ; i)!r+   z(`data` must contain at least one sample.r   Nz>each sample in `data` must contain two or more observations...z=When `paired is True`, all samples must have the same length T)paired0`vectorized` must be `True`, `False`, or `None`.ekki
vectorized`axis` must be an integer.      ?axisz!could not convert string to floatni)confidence_levelz-`n_resamples` must be a non-negative integer.n_resamples     D@+`batch` must be a positive integer or None.batchz`method` must be inmethodz?`bootstrap_result` must have attribute `bootstrap_distribution')bootstrap_resultz5Either `bootstrap_result.bootstrap_distribution.size`,SeedSequence expects int or sequence of intsherringrngr*   r+   r,   r-      )r2   r/   r0   
ValueErrorr   tupler"   r1   )r3   r%   sampler4   s   &&  r&   test_bootstrap_ivTestBootstrap.test_bootstrap_iv   sc   I&<]]:W55egrww' 6 S]]:W55vzz1#/9 6 S]]:W55vzz,78"''$O 6 E]]:W55fgg&9 6 /]]:W55vis3 6 6]]:W55vi4@ 6 B]]:W55vie< 6 B]]:W55vif= 6 @]]:W55vi6 6 @]]:W55vi7 6 (]]:W55vi8 6 T]]:W55vi2> 6 J]]:W55via8 6 A]]9G44vii8 54i 655 655 655 655 655 655 655 655 655 655 655 655 655 544s   P((P<+Q6Q$<Q8RR R4S$S,S04T<TT,(P9	<Q	Q!	$Q5	8R		R	 R1	4S	S	S-	0T	T	T)	,T=	rJ   basic
percentileBCar@   c           
     h   \         P                  P                  ^ 4      pVP                  ^
^^4      p\	        VP                  V4      3VP                  RV^ V^dR7      p\         P                  P                  ^ 4      p\	        VP                  V4      3VP                  ^
VV^dVR7      p\        VP                  P                  VP                  P                  4       \        VP                  P                  VP                  P                  4       \        VP                  VP                  4       R# )r   N)rH   rJ   random_stater@   rD   )rH   rJ   r@   rD   r\   )nprandomRandomStaterandr   r2   r"   r   confidence_intervallowhighstandard_error)r3   rJ   r@   r%   rO   r$   res1res2s   &&&&    r&   test_bootstrap_batch"TestBootstrap.test_bootstrap_batchX   s     ii##A&HHRR "**Q-)277$v&'dEii##A&"**Q-)277"V"#G 	0044d6N6N6R6RS0055t7O7O7T7TU++T-@-@Ar)   c                  aa	a
a \         P                  P                  ^ 4      p^dpSP                  VP	                  V4      4      o
SP                  VP	                  V4      4      oRV3R llo	RV	V
V3R llpSP                  S
P                  ^ ,          4      p\        V3V^ R7      p\        S
S3S	R^ R7      p\        VP                  P                  VP                  P                  4       \        VP                  P                  VP                  P                  4       \        VP                  VP                  4       R# )r   c                 D   < SP                  W,
          ^,          VR7      # )r,   r?   r!   r$   yr@   r%   s   &&&r&   my_statistic9TestBootstrap.test_bootstrap_paired.<locals>.my_statisticr   s    77AC!8$7//r)   c                 <   < SV ,          pSV ,          pS! W#4      pV# r     )ir@   abresrm   r$   rl   s   &&   r&   my_paired_statistic@TestBootstrap.test_bootstrap_paired.<locals>.my_paired_statisticu   s$    !A!Aq$CJr)   rN   T)r8   rO   N)r]   r^   r_   r2   r`   arangeshaper   r   ra   rb   rc   rd   )r3   rJ   r%   rO   nru   rq   re   rf   rm   r$   rl   s   &&f      @@@r&   test_bootstrap_paired#TestBootstrap.test_bootstrap_pairedj   s     ii##A&JJsxx{#JJsxx{#	0	 	 IIaggaj!!2:!QdB0044d6N6N6R6RS0055t7O7O7T7TU++T-@-@Ar)   r8   TFc           
       a \         P                  P                  ^ 4      pRV3R llpRpWr,          pVP                  V4      p	VP                  V4      p
VP                  V4      pSP	                  V	4      SP	                  V
4      SP	                  V4      rp	\        WV3WcV^ ^ ^dR7      pVP                  P                  VP                  P                  R,           8X  g   Q h. ROpWV&   \        V4      pSP                  SP                  W4      V4      p	SP                  SP                  W4      V4      p
SP                  SP                  W4      V4      p\        WV3WcV^ V^dR7      p\        V4      pVP                  V4       SP                  VP                  P                  V4      pSP                  VP                  P                   V4      pSP                  VP                  V4      p\#        VP                  P                  V4       \#        VP                  P                   V4       \#        VP                  V4       R# )r   c                    < SP                  WR 7      SP                  WR 7      ,           SP                  W#R 7      ,           # r?   r!   )r$   rl   zr@   r%   s   &&&&r&   rm   =TestBootstrap.test_bootstrap_vectorized.<locals>.my_statistic   s4    7717(27717+@@27717CXXXr)   )r8   rJ   rO   r@   rD   Nrw   )
         )d   )r+   r+   r+   )r]   r^   r_   r`   r2   r   bootstrap_distributionrz   rd   rT   broadcast_toreshapelistpopra   rb   rc   r   )r3   rJ   r@   r8   r%   rO   rm   rz   	n_samplesr$   rl   r   re   r   rf   result_shape
ref_ci_lowref_ci_highref_ci_standard_errors   &&&&f              r&   test_bootstrap_vectorized'TestBootstrap.test_bootstrap_vectorized   s    ii##A&	Y K	HHYHHYHHY**Q-A

1a!LQC9++11&&,,v56 	7 6 !.OOBJJq2E:OOBJJq2E:OOBJJq2E:!LTs< E{__T%=%=%A%A<P
ood&>&>&C&C\R "0C0C\ R0044jA0055{C++-BCr)   z#MemoryError with BCa observed in CIc           	        \         P                  P                  R 4      p\        P                  P                  ^^RVR7      pRp\        P                  ! \        V4      ^,
          \         P                  ! V4      \        P                  ! V4      R7      pVP                  VR7      w  rxVP                  4       p	\        VP                  V4      3VP                  RWR7      p
\        R/ V
BRV/B p\        VP                   P"                  VP                  V4      RR	7       \        VP                   P$                  VP                  V4      RR	7       \        VP&                  VP                  V	4      R
R7       V
P)                  \        ^ VR7      4       \        R/ V
BRVRR/B p\        VP                   P$                  VP                  VP+                  V4      4      RR	7       V
P)                  \        ^ VR7      4       \        R/ V
BRVRR/B p\        VP                   P"                  VP                  VP+                  ^V,
          4      4      RR	7       R# )l   )ICbX    )locscalesizer\   ffffff?)dfr   r   )
confidence)data	statisticrD   rJ   rO   rB   gMb@?rtolga2U0*3?atolrD   rK   alternativelessgreaterNrp   )r]   r^   default_rngr   normrvstlenr"   semintervalstddictr2   r   r   ra   rb   rc   rd   updateppf)r3   rJ   r%   rO   r   alphadistref_lowref_highref_seconfigrt   s   &&&         r&   test_bootstrap_against_theory+TestBootstrap.test_bootstrap_against_theory   s   
 ii##$78zz~~!14c~Jww#d)A+2774=		$P MMUM;BJJt,."''t#.9&959//33RZZ5HtT//44bjj6JQUV**BJJv,>TJdq3?@M&M5MfM//44

488E?3$	@ 	dq3?@P&P5PiP//33

488AeG#45D	Br)   zmethod, ref_low, ref_highc                &   VP                  . RO4      p\        V3VP                  RV^ R7      p\        VP                  P
                  VP                  V4      RR7       \        VP                  P                  VP                  V4      RR7       R# )r   i@B )rD   rJ   rO   g{Gzt?r   N)r   r         )@r   g+@            "   2   Q   Y   y         )r2   r   r"   r   ra   rb   rc   )r3   rJ   r   r   r%   r$   rt   s   &&&&&  r&   test_bootstrap_against_R&TestBootstrap.test_bootstrap_against_R   sr    " JJ ; <bgg76qQ//33RZZ5HuU//44bjj6JQVWr)   c                   VP                  . R
O4      pVP                  . RO4      pR p\        P                  P                  R4      p\        P
                  ! W#3VR^dVR7      p\        P
                  ! W#3VR^dVR7      p\        P
                  ! W#3VR^dVR7      pVP                  VP                  VP                  4      4      p	VP                  VP                  VP                  4      4      p
VP                  VP                  VP                  4      4      pRpW,
          \        V4      ,          pW,
          \        V4      ,          pW,
          \        V4      ,          pVR8  g   Q hVR8  g   Q h\        V4      R8  g   Q hR	# )璑bF?c                 n    \         P                  ! WR 7      p\         P                  ! WR 7      pW4,
          # r   )r   skew)r$   rl   r@   s1s2s   &&&  r&   r   ?TestBootstrap.test_multisample_BCa_against_R.<locals>.statistic   s%    A)BA)B7Nr)   l   tgy4rX   )rJ   rH   rO   rY   bcag333333?Q?N)r   gp?g|Hܿgxy[e}u׿g*g_?ggi6g2?)gF?gK?g&F}/?g?g(iC?g}$ץ?g hu?gfj}!?g1*g333333ÿ)
r2   r]   r^   r   r   r   r"   stackra   abs)r3   r%   r$   rl   r   rO   	res_basicres_percentres_bca	mid_basicmid_percentmid_bca	mid_wboot
diff_basicdiff_percentdiff_bcas   &&              r&   test_multisample_BCa_against_R,TestBootstrap.test_multisample_BCa_against_R   s^    JJ = >JJ H I
	 ii##$67OOQFIg*-38	ooqfi,/S://1&)E(+6 GGBHHY%B%BCD	ggbhh{'F'FGH''"((7#>#>?@ 	  +S^;
#/Y?'Y7 E!!!d"""8}t###r)   c           	     (  a SP                  . RO4      pSP                  . RO4      pRV3R llpW2.p\        P                  ! WT4      pRpRpVP                  p	^dp
\        P
                  ! WTWxWS4      w   r\        VSP                  R4      4       R# )	      $@c                 V   < SP                  WR 7      SP                  WR 7      ,
          # r   r!   )r   rl   r@   r%   s   &&&r&   r   HTestBootstrap.test_BCa_acceleration_against_reference.<locals>.statistic.  $    7717(27717+@@@r)   r   ge{?N)	r   g      ;@g      ?@g      D@g      G@g      I@g      J@g      Z@g     @b@)g      0@g      7@g      C@g     W@g     X@g     a@g     h@r   rx   )r2   r   r   r   _resampling_bca_intervalr   )r3   r%   rl   r   r   r   rt   r@   r   theta_hat_brH   _a_hats   &f           r&   'test_BCa_acceleration_against_reference5TestBootstrap.test_BCa_acceleration_against_reference$  s     JJFGJJ<=	A vood.00!//0;BH1rzz*>?@r)   i  i  zmethod, expectedc                   \         P                  P                  R 4      p^dpRpRp\        P                  ! ^^R7      p\        VP                  4       4      p	Rp
VP                  W3VR7      p\        VP                  V4      3VP                  VV^2VR	VR7      pVP                  pVP                  V^ ,          V	8  W^,          8  ,          4      pW8X  g   Q h\        P                  ! \        V4      V
V4      P                  pVR8  g   Q hR# )
i8   ?r   r   i  r   r\   )r   rB   rD   rH   rJ   r@   rO   皙?Nrx   )r]   r^   r   r   r   floatr"   r   r   r2   ra   count_nonzero	binomtestintpvalue)r3   rJ   expectedr%   rO   r{   rD   rB   r   	stat_truen_replicationsr   rt   cici_contains_truer   s   &&&&            r&   #test_bootstrap_against_itself_1samp1TestBootstrap.test_bootstrap_against_itself_1samp@  s
    ii##G, zzaq)$))+&	 xxn0sxCD)+"$'')9$/ %! $$ ++RUY->9RSuCT,UV+++ %5!6!13396 	||r)   i|  iz  c                  a \         P                  P                  ^ 4      p^dp^xpRpRpRV3R llp	\        P                  ! ^ ^R7      p
\        P                  ! R^R7      p\        V
P                  4       VP                  4       ,
          4      pRpV
P                  W3VR7      pVP                  W3VR7      p\        SP                  V4      SP                  V4      3V	VV^2VR
VR7      pVP                  pSP                  V^ ,          V8  VV^,          8  ,          4      pVV8X  g   Q h\        P                  ! \        V4      VV4      P                  pVR8  g   Q hR	# )r   r   r   c                 \   < SP                  WR 7      pSP                  WR 7      pW4,
          # r   r!   )data1data2r@   mean1mean2r%   s   &&&  r&   my_statBTestBootstrap.test_bootstrap_against_itself_2samp.<locals>.my_stat{  s+    GGEG-EGGEG-E= r)   r   r     r   )r   rB   rD   rH   rJ   r@   r\   Nrx   rw   )r]   r^   r_   r   r   r   r"   r   r   r2   ra   r   r   r   r   )r3   rJ   r   r%   rO   n1n2rD   rB   r  dist1dist2r   r   r   r   rt   r   r   r   s   &&&f                r&   #test_bootstrap_against_itself_2samp1TestBootstrap.test_bootstrap_against_itself_2sampk  sP    ii##A&	! 

q*

s!,%**,56	 		3#	F		3#	FE*BJJu,=>"))9$/ %%(* $$ ++RUY->9rRSuCT,UV8+++ %5!6!13396 	||r)   dtypefloat32float64c           
     f  aa R ^ /V3R llpV3R lp\         P                  P                  ^ 4      pVP                  ^^4      P	                  S4      pVP                  ^^4      P	                  S4      p	VP                  ^^4      P	                  S4      p
\        SP                  V4      SP                  V	4      SP                  V
4      3VRV^dV^ R7      p\        WV
3VRV^dV^ R7      pSR8X  d   RMRp\        VP                  P                  SP                  VP                  P                  4      VR	7       \        VP                  P                  SP                  VP                  P                  4      VR	7       \        VP                  SP                  VP                  4      VR	7       R
# )r@   c                 2   <a  \        V V3R  lV 4       4      # )c              3   J   <"   T F  pSP                  VSR 7      x  K  	  R# 5i)r?   Nr!   ).0rU   r@   r%   s   & r&   	<genexpr>STestBootstrap.test_bootstrap_vectorized_3samp.<locals>.statistic.<locals>.<genexpr>  s!     EfrwwvDw11s    #sum)r@   r   r%   s   d*r&   r   @TestBootstrap.test_bootstrap_vectorized_3samp.<locals>.statistic  s    EEEEr)   c                     < V  F  pVP                   ^8X  d   K  Q h	  \        P                  ! \        R V  4       4      SR7      # )r+   c              3   @   "   T F  qP                  4       x  K  	  R # 5ir    r!   )r  rU   s   & r&   r  VTestBootstrap.test_bootstrap_vectorized_3samp.<locals>.statistic_1d.<locals>.<genexpr>  s     !CdF++--ds   r  )ndimr]   r2   r  )r   rU   r  s   * r&   statistic_1dCTestBootstrap.test_bootstrap_vectorized_3samp.<locals>.statistic_1d  s;    {{a''' ::c!Cd!CC5QQr)   T)r<   r@   rD   rJ   rO   Fr  ư>+=r   N)r]   r^   r_   r`   astyper   r2   r   ra   rb   rc   rd   )r3   rJ   r@   r  r%   r   r  rO   r$   rl   r   re   rf   r   s   &&&ff         r&   test_bootstrap_vectorized_3samp-TestBootstrap.test_bootstrap_vectorized_3samp  sh   	F! 	F	R ii##A&HHQN!!%(HHQN!!%(HHQN!!%("**Q-A

1F"t$C &A/ !LU"FK 	)tu0044

4#;#;#?#?@t	M0055

4#;#;#@#@A	N++RZZ8K8K-LSWXr)   z'Failure is not concerning; see gh-14107c                V  a RV3R llpR p\         P                  P                  R4      pVP                  R	4      p\        SP	                  V4      3VRV^dRV^ R7      p\        V3VRV^d^
V^ R7      p	\        VP                  P                  SP	                  V	P                  P                  4      4       \        VP                  P                  SP	                  V	P                  P                  4      4       \        VP                  SP	                  V	P                  4      4       R# )
r   c                 (   < SP                  WR 7      # r   r!   r$   r@   r%   s   &&r&   r   @TestBootstrap.test_bootstrap_vectorized_1samp.<locals>.statistic  s    7717((r)   c                 L    V P                   ^8X  g   Q hV P                  ^ R7      # r+   r?   )r  r"   r$   s   &r&   r  CTestBootstrap.test_bootstrap_vectorized_1samp.<locals>.statistic_1d  s"    66Q;;66q6>!r)   l   2 TN)r<   r@   rD   rH   rJ   rO   Fr   )r,   r-   )
r]   r^   r   r   r2   r   ra   rb   rc   rd   )
r3   rJ   r@   r%   r   r  rO   r$   re   rf   s
   &&&f      r&   test_bootstrap_vectorized_1samp-TestBootstrap.test_bootstrap_vectorized_1samp  s    	)	"
 ii##J/JJv"**Q-)9D%(VL!|D%(6qJ0044

4#;#;#?#?@	B0055

4#;#;#@#@A	C++RZZ8K8K-LMr)   c           
        VP                  R
R4      pVR8X  d   \        P                  ! RR7      ;_uu_ 4        Rp\        P                  ! \
        P                  VR7      ;_uu_ 4        \        V.VP                  VR7      p\        VP                  P                  VP                  VP                  4      4       \        VP                  P                  VP                  VP                  4      4       RRR4       RRR4       Mw\        V.VP                  VR7      p\        VP                  P                  VP                  R4      4       \        VP                  P                  VP                  R4      4       \        XP                  VP                  R	4      4       R#   + '       g   i     L; i  + '       g   i     LJ; i)#   g     @rZ   ignore)invalidz0The BCa confidence interval cannot be calculatedr   rI   N        )r/  )fullr]   errstater/   warnsr   DegenerateDataWarningr   r"   r   ra   rb   r2   nanrc   rd   )r3   rJ   r%   r   msgrt   s   &&&   r&   test_bootstrap_degenerate'TestBootstrap.test_bootstrap_degenerate  s+   wwuf%U?X..H\\%"="=SII#THbggfEC#C$;$;$?$?BFFAST#C$;$;$@$@"**RVVBTU J /. THbggf=CC3377F9KLC3388"**V:LM**BJJrN; JI /.s$   1F8*BF%	6F8%F50F88G	c           	        \         P                  P                  R 4      p\        P                  ! ^^R7      pVP                  ^dVR7      p\        VP                  V4      3\        P                  V^d\         P                  P                  R4      R7      p\        V3\        P                  V^d\         P                  P                  R4      RR7      p\        VP                  P                  VP                  VP                  P                  4      4       \        VP                  P                  VP                  VP                  P                  4      4       \        VP                  VP                  VP                  4      4       R# )l   E<1

 r   r   i[%  rJ   rD   rO   F)rJ   rD   rO   r<   N)r]   r^   r   r   r   r   r   r2   r   r   ra   rb   rc   rd   )r3   rJ   r%   rO   r   r   rt   refs   &&&     r&   test_bootstrap_gh15678$TestBootstrap.test_bootstrap_gh15678  s    ii##O4zzaq)xxSsx3D)+UZZTWII11$79 FII11$7EK//33

3#:#:#>#>?	A//44

3#:#:#?#?@	B**BJJs7I7I,JKr)   c           	        \         P                  P                  R 4      p\        P                  ! ^^R7      pVP                  ^dVR7      p\         P                  ! V4      pVP                  V4      p\        V3VP                  R^d\         P                  P                  R4      R7      p\        VP                  P                  VP                  V4      4       \        V) 3VP                  R^d\         P                  P                  R4      R7      p\        VP                  P                  ) VP                  P                  4       \        VP                  P                  ) VP                  P                  4       R# )l   n!|'x`5 r   r   rZ   if  r<  N)r]   r^   r   r   r   r   minr2   r   r   ra   rb   maxr   rc   )r3   r%   rO   r   r   true_minrt   rf   s   &&      r&   test_bootstrap_min TestBootstrap.test_bootstrap_min  s    ii##$45zzaq)xxSsx366$<zz$3II11$79//33RZZ5IJ4%266%SYY2248:00444d6N6N6S6ST00555t7O7O7S7STr)   additional_resamplesr  c           
        \         P                  P                  R 4      pVP                  ^dR7      pRpTpWQ,           p\         P                  P                  R4      p\        P                  ! VP                  V4      3VP                  WSRRR7      p\        P                  ! VP                  V4      3VP                  WcRRVR	7      p\         P                  P                  R4      p\        P                  ! VP                  V4      3VP                  WsRRR7      p	\        VP                  P                  VP                  V	P                  P                  4      R
R7       \        VP                  P                  VP                  V	P                  P                  4      R
R7       \        VP                  VP                  V	P                  4      R
R7       R# )l    ]4M r   r  l   mdpi4 r   rY   )rD   rO   rB   rJ   r   rZ   )rD   rO   rB   rJ   rK   r   r   N)r]   r^   r   r   r   r2   r"   r   ra   rb   rc   rd   )
r3   rF  r%   rO   r$   r  r  n3rt   r=  s
   &&&       r&   test_re_bootstrapTestBootstrap.test_re_bootstrap  sn    ii##$45JJCJ !&ii##$67oorzz!}.R/3LJoorzz!}.R/3E/24 ii##$67oorzz!}.R/3EC 	//33

3#:#:#>#>?"	$ 	//44

3#:#:#?#?@"	$ 	**BJJs7I7I,JQVWr)   zSensitive to machine precisionc                t   \         P                  P                  R 4      p\        P                  ! ^^R7      pVP                  VP                  ^dVR7      4      3p\        WRP                  VRR7      p\        P                  ! R/ VBRR/B pVP                  \        ^ VR7      4       \        P                  ! R/ VBRRRR	/B p\        P                  ! R/ VBRRRR
/B p	\        VP                  P                  VP                  P                  RR7       \        V	P                  P                  VP                  P                  RR7       VP                  VP                  P                  4      '       d   VP                  P                  ^ 8  g   Q hVP                  V	P                  P                  4      '       d   V	P                  P                  ^ 8  g   Q h\         P"                  ! \$        RR7      ;_uu_ 4        \        P                  ! R/ VBRR/B  RRR4       R#   + '       g   i     R# ; i)l   @Qixt r   r   )r   r   rO   r@   rB   r   r   r   r   r   r   r   r   z`alternative` must be one ofr   z	ekki-ekkiNrx   rp   )r]   r^   r   r   r   r2   r   r   r   r   r   r   ra   rc   rb   isinfr/   r0   rS   )
r3   rJ   r%   rO   r   r   r   r   lgs
   &&&       r&   test_bootstrap_alternative(TestBootstrap.test_bootstrap_alternative#  s    ii##$78zzaq)

488#S8ABD466sDOO;f;s;dq1=>OOPfPtPPOOSfStSS--22A4I4I4N4N"	$--1113H3H3L3L"	$xx--1122q7L7L7P7PST7TTTxx--22338M8M8R8RUV8VVV]]:-KLLOO>f>+> MLLLs   H&&H7	c                   R	p\         P                  P                  R4      pVP                  VR7      p\        \        P
                  ! VP                  V4      VR7      4      p\        VR
,          4       FA  pVRVR3,          p\         P                  ! WFR
R7      p\        WqP                  V4      4       KC  	  \        \        P
                  ! VP                  V4      ^VR7      4      p	\        VP                  V	RR7      V4       R# )r-      Zt rH  r%   .NNNr?   )rH   r%   Nr-   rQ         rx   )r]   r^   r   nextr   _jackknife_resampler2   rangedeleter   r   concat)
r3   r%   rz   rO   r$   rl   rq   slcr   y2s
   &&        r&   test_jackknife_resample%TestBootstrap.test_jackknife_resample;  s    ii##J/JJEJ"00A2FGuRy!A CAI,CyyB/HCH!56 " +11"**Q-qRPQ		"2	.2r)   array_api_strictzTest uses ... + fancy indexingrng_namer_   r   c           
        \        \        P                  V4      pV! R 4      pV! R 4      p^
pRp\        P                  P                  R4      pVP	                  VP                  V4      4      p	\
        P                  ! WWBR7      p
\        V4       FP  pV
RVR3,          pVP	                  \        V^ VR,          VR,          4      4      pV	RV3,          p\        W4       KR  	  R# )l   1V rS  )rO   r%   .rU  NrV  rx   )
getattrr]   r^   r   r2   r   _bootstrap_resampler\  r   r   )r3   rd  r%   rng_genrng1rng2rD   rz   rO   r$   rl   rq   r_  jsr   s   &&&            r&   test_bootstrap_resample%TestBootstrap.test_bootstrap_resampleL  s     "))X.z"z"ii##J/JJszz%()++AL{#A CAI,CLq%)U2YGHBbzHC* $r)   scorec                V   R	p\         P                  P                  R4      pVP                  V4      p\        V4      p\        P
                  ! VP                  WgR7      VP                  WR7      R
VR7      pR p	V	! WaR
R7      ^d,          p
\        WP                  WR7      RR7       R# )r   l   Q,? r  )r@   r%   c                 N    \         P                  ! \        P                  W V4      # r    )r]   apply_along_axisr   percentileofscore)rr   rn  r@   s   &&&r&   vectorized_pos>TestBootstrap.test_percentile_of_score.<locals>.vectorized_posp  s    &&u'>'>OOr)   r?   V瞯<r   N)r         rx   )r]   r^   r   r   r   _percentile_of_scorer2   r   )r3   rn  r@   r%   rz   rO   r$   r  prs  p2s   &&&&       r&   test_percentile_of_score&TestBootstrap.test_percentile_of_scoree  s     ii##J/JJu $,,RZZZ-G-/ZZZ-K24=	P A2.s2::b:6UCr)   c                4  a
 R  o
V
3R lp\         P                  ! V4      p\        P                  P	                  ^ 4      pVP                  ^^^4      pVP                  ^^^4      pVP                  ^^^4      pS
! WVWqR7      pV! WVWqR7      p	\        W4       R# )c                 .   a  \        V 3R  lV 4       4      # )c              3   D   <"   T F  qP                  S4      x  K  	  R # 5ir    r!   )r  rU   r@   s   & r&   r  LTestBootstrap.test_vectorize_statistic.<locals>.statistic.<locals>.<genexpr>~  s     <tV{{4((ts    r  r@   r   s   d*r&   r   9TestBootstrap.test_vectorize_statistic.<locals>.statistic|  s    <t<<<r)   c                  L   < V  F  pVP                   ^8X  d   K  Q h	  S! V R^ / # )r+   r@   )r  )r   rU   r   s   * r&   r  <TestBootstrap.test_vectorize_statistic.<locals>.statistic_1d  s/    {{a''' d+++r)   r?   N)r   _vectorize_statisticr]   r^   r_   r`   r   )r3   r@   r  
statistic2rO   r$   rl   r   re   rf   r   s   &&        @r&   test_vectorize_statistic&TestBootstrap.test_vectorize_statisticw  s    
	=	, !55lC
ii##A&HHQ1HHQ1HHQ1q,!-#r)   c           
       a \         P                  P                  R 4      pRpSP                  VP                  ! VRR	/ 4      pV3R lp\        V3WaR
R^VR7      pSP                  ^R.4      pSP                  VP                  P                  P                  V8  VP                  P                  P                  V8  ,          ^ R7      pSP                  V^Z8  4      '       g   Q hSP                  V^d8*  4      '       g   Q hVP                  P                  P                  R8X  g   Q hVP                  P                  P                  R8X  g   Q hVP                  P                  R8X  g   Q hVP                  P                  R8X  g   Q hR# )l   s:       ?r   c           	      l   < SP                  SP                  WR 7      SP                  W^R7      .4      # )r?   r@   
correction)r   r"   r   )r   r@   r%   s   &&r&   r   =TestBootstrap.test_vector_valued_statistic.<locals>.statistic  s9    88RWWTW5VVDVBD E Er)   '  )rJ   r@   rD   rH   r\   r?   N)r+   r  )r   r   rx   r,   r   )r,   r   r  )r]   r^   r   r2   normalr   r   ra   rb   Trc   allrz   rd   r   )	r3   rJ   r%   rO   paramsrU   r   rt   countss	   &&f      r&   test_vector_valued_statistic*TestBootstrap.test_vector_valued_statistic  si    ii##J/CJJ@Z@A	E 	9"$(#G QH%!!3#:#:#>#>#@#@6#I%(%<%<%A%A%C%Cf%L#N'( " * vvfl####vvfm$$$$&&**00H<<<&&++11X===!!''8333))//>AAAr)   zignore::RuntimeWarningc                  aa \         P                  P                  R 4      pR oV3R loV3R lp. R	O. R
O. RO. RO. RO.p\         P                  ! V4      P                  p\        W2VRR7      p\        VSVRR7      p\        VP                  P                  ^ ,          VP                  P                  RR7       \        VP                  P                  ^ ,          VP                  P                  RR7       R# )l   \Qc                 <   V P                  V4      pVP                  V4      pWR,          ,
          WR,          ,
          ,          P                  V4      p^V,          V P                  V4      VP                  V4      ,           W4,
          ^,          ,           ,          # ).).N)r"   var)r$   rl   r@   xmymcovs   &&&   r&   concordanceGTestBootstrap.test_vector_valued_statistic_gh17715.<locals>.concordance  sn    BB9%!m*;<BB4HCGdaeeDk 9RWN JKKr)   c                 ^   < W,           pW,           p\         P                  ! S! WVV4      4      # r    )r]   
nan_to_num)tptnfpfnr@   actualr   r  s   &&&&&  r&   r   ETestBootstrap.test_vector_valued_statistic_gh17715.<locals>.statistic  s'    WFwH==Vt!DEEr)   c                 H   < S! . VOV N5!  \         P                  R 3,          # ).)r]   newaxis)r@   argsr   s   $*r&   statistic_extradimNTestBootstrap.test_vector_valued_statistic_gh17715.<locals>.statistic_extradim  s#    )d)D)"**c/::r)   T)rO   r8   ru  r   N)rQ   r   r   r,   )r,   r+   r,   r+   )r   rX  r   r   )r   rX  r-   r   )r      r+   r   )
r]   r^   r   arrayr  r   r   ra   rb   rc   )r3   rO   r  r   rt   r=  r  r   s   &     @@r&   $test_vector_valued_statistic_gh177152TestBootstrap.test_vector_valued_statistic_gh17715  s     ii##$67	L	F
	; 	
 xx~c$GiS>//33A6//33%	A//44Q7//445	Br)   cupy)np_only
exceptionsc                   \         P                  P                  R 4      pVP                  VP                  R4      4      pVP                  VP                  R4      4      pR p\        P
                  ! W43V4       \        P
                  ! VP                  VP                  3V^R7       Rp\        P                  ! \        VR7      ;_uu_ 4        \        P
                  ! W4R,          3V4       RRR4       \        P
                  ! W4R	,          3V4       \        P
                  ! VP                  VP                  R
,          3V^R7       R#   + '       g   i     Lg; i)iF|c                 F    \         P                  ! WVR 7      P                  # r   r   	ttest_indr   r$   rl   r@   s   &&&r&   r   .TestBootstrap.test_gh_20850.<locals>.statistic      ??1d3===r)   r?   /Array shapes are incompatible for broadcasting.r   N)r   r,   )r   r,   )Nr   Nr   )r  r   r+   N)r  r  )
r]   r^   r   r2   r   r   r  r/   r0   rS   )r3   r%   rO   r$   rl   r   r4   s   &&     r&   test_gh_20850TestBootstrap.test_gh_20850  s    ii##J/JJszz'*+JJszz'*+	> 		*acc
IA6 D]]:W55OOQ&	NI6 6hK()4acc(m,ia@ 65s    EE	rp   N)rX   rY   rZ   r   r+   r,   ))rX   gQ7@gHzS@)rY   g\(<@g=
ףpU@)rZ   gHz'@@gQV@)rZ   rX   rY   )r   r  r+   )*r.   
__module____qualname____firstlineno__r   r5   rV   r/   markparametrizerg   r|   r   slowxfail_on_32bitr   tests_Rr   r   r   tests_against_itself_1sampitemsr   tests_against_itself_2sampr
  r"  r,  r9  r>  rD  rJ  rP  ra  rl  r{  r  r  filterwarningsr  r  __static_attributes____classdictcell____classdict__s   @r&   r   r      s    g&<=F >F
99v [[X'EF[[VY/B 0 GB  [[X'EFB GB2 [[X'EF[[VY/[[Xe}5)D 6 0 G)DV [[[[ EF[[X'EFB G G B6&G [[8'BX CX,7$rA0 #*4"."'"/ [[[[/7==?A#A #J #*3"."5 [[[[/7==?A,A ,\ [[X'EF[[VaV,[[Wy)&<=Y > - GY8 [[ IJ[[X'EF[[VaV,N - G KN, [[X'EF< G< [[X'EFL GL"U  [[3aY?X @X8 [[ @A[[X'EF? G B?,3" [[!!"4)I " K[[Z-)GH+ IK+, [[Wk2[[VY/D 0 3D  [[VY/$ 0$4 [[[[X'EFB G B> [[[[ 89#B : #BL [[!!$F8!DA EAr)   r   c            
       F  a  ] tR tRt o RtR]3R ltR tR tR t	]
P                  P                  R 4       t]
P                  P                  R	]! R^4      4      R
 4       t]
P                  P                  RR 4      R 4       t]
P                  P$                  ]
P                  P                  RR!4      ]
P                  P                  R]P&                  ! R"R^4      4      R 4       4       4       t]
P                  P                  R]P,                  ]P.                  34      ]
P                  P                  RR#4      ]
P                  P                  R]P&                  ! R$^^4      4      R 4       4       4       t]
P                  P                  R]P2                  ! R$^4      4      R 4       t]
P                  P                  ]
P                  P                  R]P&                  ! R"R^4      4      R 4       4       t]
P                  P$                  ]
P                  P                  RRR.4      ]
P                  P                  R. R%O4      R 4       4       4       tR tR tR t]
P                  PA                  ^4      ]
P                  PC                  R4      R 4       4       t"Rt#V t$R# )&TestMonteCarloHypothesisTesti  皙?Nc                   aaaa VVVV3R  l# )c                  :   < SP                  S! V R S/VB SR7      # )r\   r  )r2   )r  kwdsr  rsrvs_inr%   s   *,r&   r'   6TestMonteCarloHypothesisTest.get_rvs.<locals>.<lambda>  s(    RZZ0V20VQU0V6; &0 &=r)   rp   )r3   r  r  r  r%   s   &ffffr&   get_rvs$TestMonteCarloHypothesisTest.get_rvs  s    = 	=r)   c                   a V3R  lpV# )c                    < SP                  WR 7      pSP                  W^R7      pV P                  V,          pW#V,          R,          ,          # )r?   r  r  )r"   r  rz   )r$   r@   mvr{   r%   s   &&   r&   r   =TestMonteCarloHypothesisTest.get_statistic.<locals>.statistic  sB    %Aq2AA!cz>!r)   rp   )r3   r%   r   s   &f r&   get_statistic*TestMonteCarloHypothesisTest.get_statistic  s    	" r)   c           	       a SP                  . RO4      pRV3R llpRpSP                  R 4      SP                  R!4      3p\        P                  P                  \        P                  P                  3p\
        P                  ! \        VR7      ;_uu_ 4        \        WVR R"R7       RRR4       R	p\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  VR
R7       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  VR
R7       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        VRV4       RRR4       \
        P                  ! \        VR7      ;_uu_ 4        SP                  R R.RR..4      p\        VR R.V4       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        SP                  . RO.4      p\        VR R .V4       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  R4       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  VR#R7       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  VRR7       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  VR#R7       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  VRR7       RRR4       Rp\
        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P                  VRR7       RRR4       RpV3R lp \        W&SP                  4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL@; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELX; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELP; i  + '       g   i     EL; i  \         d.   p\        T4      P                  T4      '       g   Q h Rp?R# Rp?ii ; i)$      ?       @      @Nc                 (   < SP                  WR 7      # r   r!   r&  s   &&r&   stat@TestMonteCarloHypothesisTest.test_input_validation.<locals>.stat  s    7717((r)   r  r   c                     ^# r+   rp   r  s   &&&r&   r'   DTestMonteCarloHypothesisTest.test_input_validation.<locals>.<lambda>      1r)   r?   r=   r>   r9   r;   0`rvs` must be callable or sequence of callables.      @c                     V # r    rp   r*  s   &r&   r'   r        ar)   If `rvs` is a sequence...c                     V # r    rp   r*  s   &r&   r'   r     r  r)   c                     V # r    rp   r*  s   &r&   r'   r     r  r)   z`statistic` must be callable.)`n_resamples` must be a positive integer.rC   rE   rF   rG   `alternative` must be in...r:   r   z!Signature inspection of statisticc                 b   < SP                  \        P                  P                  V R 7      4      # )rH  )r2   r   r   r   )r   r%   s   &r&   r   ?TestMonteCarloHypothesisTest.test_input_validation.<locals>.rvs<  s!    ::ejjnn$n788r)   r  r  r  r    r,   rW  )r-   rW  rx   rR   )r2   zerosr   r   r   r/   r0   rS   r   r1   r"   str
startswith)r3   r%   r   r  r4   tempr   es   &f      r&   test_input_validation2TestMonteCarloHypothesisTest.test_input_validation  s    zz,'	) D "((6"23zz~~uzz~~.]]:W55T(<2F 6 /]]:W55T5::>>4cB 6 E]]:W55T5::>>4CH 6 E]]9G44T4. 5]]9G44::Bx"b23DTK#6= 5 .]]:W55::|n-DTK#=tD 6 2]]9G44T5::>>48 5 >]]:W55T5::>>4UK 6 >]]:W55T5::>>4VL 6 @]]:W55T5::>>4uE 6 @]]:W55T5::>>4vF 6 0]]:W55T5::>>4VL 6 6	9	.T0i 655 655 655 544444
 655
 544 655 655 655 655 655  	.q6$$W----	.s   Q$(Q8-(RR =(R4&S'&S;(S0(T'(T=(T,(U U $Q5	8R		R	 R1	4S	S	S-	0T	T	T)	,T=	 U	V"VVc           	     \  a V3R  lpRpSP                  . RO4      p\        S4      '       d(   \        V\        P                  P
                  V4       R# \        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P
                  V4       RRR4       \        P                  ! \        VR7      ;_uu_ 4        \        V\        P                  P
                  SP                  RR7       RRR4       R#   + '       g   i     Lp; i  + '       g   i     R# ; i)c                 &   < SP                  V 4      # r    r!   r#   s   &r&   non_vectorized_statisticWTestMonteCarloHypothesisTest.test_input_validation_xp.<locals>.non_vectorized_statisticD  s    771:r)   z!`statistic` must be vectorized...Nr   Fr;   r  )
r2   r   r   r   r   r   r/   r0   rS   r"   )r3   r%   r  r4   rU   s   &f   r&   test_input_validation_xp5TestMonteCarloHypothesisTest.test_input_validation_xpC  s    	 6L)B<<VUZZ^^5MN]]:W55VUZZ^^5MN 6]]:W55VUZZ^^RWWO 65 65555s   9&D2DD	D+	c                  a aa \         P                  P                  R 4      pSP                  VP	                  ^
R7      4      pV VV3R lo^ Sn        ^ Sn        RVRSRRRR/pS P                  \        P                  P                  \         P                  P                  R	4      SR
7      VR&   \        RR^/VB p\        SP
                  R4       \        SP                  ^4       S P                  \        P                  P                  \         P                  P                  R	4      SR
7      VR&   ^ Sn        \        RR^2/VB p\        SP
                  ^4       \        SP                  ^24       S P                  \        P                  P                  \         P                  P                  R	4      SR
7      VR&   ^ Sn        \        R/ VB p\        SP
                  ^4       \        SP                  R4       \        VP                  VP                  4       \        VP                  VP                  4       R# )   )p rH  c                    < V P                   ^8X  d   ^MV P                  ^ ,          p\        VSP                  4      Sn        S;P                  ^,          un        SP                  S4      ! WR7      # r)  )r  rz   rB  
batch_sizecounterr  )r$   r@   r  r3   r   r%   s   && r&   r   :TestMonteCarloHypothesisTest.test_batch.<locals>.statisticY  sX    ffkqwwqzJ#&z93G3G#HI "%%b)!77r)   rU   r   rD   r  r<   Ti rT  r   rH     Nrp   )r]   r^   r   r2   standard_normalr  r  r  r   r   r   r   r   r   r   )	r3   r%   rO   r$   r  re   rf   res3r   s	   ff      @r&   
test_batch'TestMonteCarloHypothesisTest.test_batchR  s    ii##K0JJs***34	8
 	 	![)t\49 ll5::>>2993H3H3PUWlXU0a040Y&&-Y))1-ll5::>>2993H3H3PUWlXU	1b1D1Y&&+Y))2.ll5::>>2993H3H3PUWlXU	'$'Y&&*Y))40T[[1T[[1r)   r@   c           	        \         P                  P                  R 4      p. ROp^dWA&   VP                  R4      P                  pR\        V4      9   d   RMRp\        \         V4      p\        W&4      pVP                  WGR7      p	\        P                  ! V	RVR7      p
VP                  WR7      p	V P                  V4      pV P                  \        P                  P                  W8VR	7      p\        WVR
RVR7      pVP                  V
P                  VR7      pVP                  V
P                   VR7      p\#        VP                  V4       \#        VP                   WP$                  R7       R# )it$ r  64r  r  )r   r  r2  )popmeanr@   r  )r  r%   Ti N  )r<   rD   r@   r   N)r,   r-   rQ   )r]   r^   r   r2   r  r  rf  r  r   ttest_1sampr  r  r   r   r   r   r   r   r   )r3   r@   r%   rO   r   dtype_default	dtype_strdtype_npr  r$   r   r   r   rt   ref_statistic
ref_pvalues   &&&             r&   test_axis_dtype,TestMonteCarloHypothesisTest.test_axis_dtypex  s,    ii##G,
 

2,,!%]);!;I)	2y)& T:$$Q>JJqJ&&&r*	ll5::>>3lCqyT+0t= 

8#5#5U
CZZuZ=
}5

JYY?r)   r   c                "   \         P                  P                  R 4      pVP                  ^R7      p\        P
                  ! VRVR7      pVP                  V4      pV P                  V4      pV P                  \        P                  P                  W2R7      p\        WGWaR7      p\        VP                  VP                  VP                  4      4       \        VP                  VP                  VP                  4      V P                  R7       R# ))rH  r2  r  rT  r   N)r]   r^   r   r  r   r  r2   r  r  r   r   r   r   r   r   r   )	r3   r   r%   rO   r$   r=  r   r   rt   s	   &&&      r&   test_alternative-TestMonteCarloHypothesisTest.test_alternative  s     ii##H-R(2;?JJqM&&r*	ll5::>>3l6qyJrzz#--'@A

BJJszz$:Kr)   rr   r  c           	       a \         P                  P                  R 4      p\        P                  P                  V^VR7      p\        P                  ! V\        P                  P                  SR7      pV3R lpV P                  \        P                  P
                  V4      p\        WGVRRSR7      p\        VP                  VP                  4       SR8X  d/   \        VP                  VP                  V P                  R7       R
# SR	8X  d6   \        ^VP                  ,
          VP                  V P                  R7       R
# R
# )r   rr   r   r\   r  c                 |   < \         P                  ! V \         P                  P                  R SR7      P                  # )asymp)moder   )r   ks_1sampr   cdfr   )r$   r   s   &r&   statistic1dGTestMonteCarloHypothesisTest.test_against_ks_1samp.<locals>.statistic1d  s+    >>!UZZ^^'.9;;D9Er)   r  FrD   r<   r   r   r   r   N)r]   r^   r   r   skewnormr   r(  r   r)  r  r   r   r   r   r   )	r3   r   rr   rO   r$   r   r*  norm_rvsrt   s	   &f&      r&   test_against_ks_1samp2TestMonteCarloHypothesisTest.test_against_ks_1samp  s    
 ii##H-NN#>>>!UZZ^^M	E <<

4qK+/E+68 	x'9'9:)#CJJdiiHF"AcjjL(//		J #r)   hypotestc                  a \         P                  P                  R 4      p\        P                  P                  V^VR7      pS! WRR7      pV3R lpV P                  \        P                  P
                  V4      p\        WXVRVR7      p	\        V	P                  VP                  4       \        V	P                  VP                  V P                  R7       R# )i	r$  r  c                 *   < S! WR 7      P                   # r   )r   )r$   r@   r1  s   &&r&   r   LTestMonteCarloHypothesisTest.test_against_normality_tests.<locals>.statistic  s    A)333r)   Tr<   r   r   N)r]   r^   r   r   r-  r   r  r   r   r   r   r   r   )
r3   r1  r   rr   rO   r$   r   r   r.  rt   s
   &f&&      r&   test_against_normality_tests9TestMonteCarloHypothesisTest.test_against_normality_tests  s    
 ii##H-NN3?A7	4 <<

4qI$+68 	x'9'9:

HOO$))Dr)   c                   \         P                  P                  R 4      p\        P                  P                  V^VR7      p\        P                  ! V4      pR pV P                  \        P                  P
                  V4      p\        W6VRRR7      p\        VP                  VP                  4       \        VP                  VP                  V P                  R7       R# )i!M r$  c                 D    \         P                  ! WR 7      P                  # r   )r   
normaltestr   )r$   r@   s   &&r&   r   GTestMonteCarloHypothesisTest.test_against_normaltest.<locals>.statistic  s    ##A1;;;r)   Tr   r5  r   N)r]   r^   r   r   r-  r   r:  r  r   r   r   r   r   r   )r3   rr   rO   r$   r   r   r.  rt   s   &&      r&   test_against_normaltest4TestMonteCarloHypothesisTest.test_against_normaltest  s     ii##H-NN3?##A&	< <<

4qI$+46 	x'9'9:

HOO$))Dr)   c           	        \         P                  P                  R 4      p\        P                  P                  V^VR7      p\        P                  ! V\        P                  P                  4      pR pV P                  \        P                  P
                  V4      p\        W6VRRRR7      p\        VP                  VP                  4       \        VP                  VP                  V P                  R7       R# )	ir$  c                 t    \         P                  ! V \         P                  P                  4      P                  # r    )r   cramervonmisesr   r)  r   r*  s   &r&   r*  MTestMonteCarloHypothesisTest.test_against_cramervonmises.<locals>.statistic1d  s#    ''5::>>:DDDr)   r  Fr   r,  r   N)r]   r^   r   r   r-  r   r@  r   r)  r  r   r   r   r   r   )r3   rr   rO   r$   r   r*  r.  rt   s   &&      r&   test_against_cramervonmises8TestMonteCarloHypothesisTest.test_against_cramervonmises  s     ii##I.NN#>''5::>>:	E <<

4qK+/E+46 	x'9'9:

HOO$))Dr)   	dist_namer   logistictarget_statisticc                  aa VV3R  lp\         P                  ! 4       ;_uu_ 4        \         P                  ! R\        4       \	        V^ R7      pRRR4       XP
                  '       g   Q hVP                  ^ ,          p\        P                  P                  R4      p\        P                  P                  V^dVR7      p\        P                  ! VSRR7      pVP                  p	VP                  p
V3R lpV P!                  \#        \        S4      P                  V4      p\         P                  ! 4       ;_uu_ 4        \         P                  ! R\        4       \%        W|VR	R
RR7      pRRR4       \'        XP                  V	4       \'        VP                  V
^V P(                  ,          R7       R#   + '       g   i     ELl; i  + '       g   i     Le; i)c                    < \         P                  P                  R 4      p\        P                  P                  V ^dVR7      p\        P                  ! VSRR7      pVP                  S,
          # )xr   interpolaterI   )r]   r^   r   r   tukeylambdar   andersonr   )rr   rO   r$   r   rD  rF  s   &   r&   fun?TestMonteCarloHypothesisTest.test_against_anderson.<locals>.fun	  sX    ))''	2C!!%%ac%DA~~a=IH%%(888r)   r0  )x0NrI  r   rJ  rI   c                 J   < \         P                  ! V SR R7      P                  # )rJ  rI   )r   rL  r   )r$   rD  s   &r&   r*  GTestMonteCarloHypothesisTest.test_against_anderson.<locals>.statistic1d  s    >>!Y}EOOOr)   r  Fr   r,  r   )warningscatch_warningssimplefilterRuntimeWarningr   successr$   r]   r^   r   r   rK  r   rL  r   r   r  rf  r   r   r   )r3   rD  rF  rM  solrr   rO   r$   r   expected_stat
expected_pr*  dist_rvsrt   s   &ff           r&   test_against_anderson2TestMonteCarloHypothesisTest.test_against_anderson   sL   	9
 $$&&!!(N;sq/C ' {{{{ EE!Hii##I.!!!#C!@>>!Y}E **__
	P <<y 9 = =sC$$&&!!(N;"1#.D.3LC ' 	}5

JQtyy[A5 '&&& '&s   )F3>,G3G	G	c                    \         P                  P                  R 4      p\         P                  ! ^d4      p\	        W!P                  \         P
                  RRR7      pVP                  R8X  g   Q hR# )l   IL~QH(s Tr   r5  g-C6?N)r]   r^   r   r  r   r"   r   )r3   rO   r$   rt   s   &   r&   test_p_never_zero.TestMonteCarloHypothesisTest.test_p_never_zero*  sT     ii##$78HHSMq**bgg*.FDzzV###r)   c                   \         P                  P                  R 4      pVP                  RR7      VP                  ^R7      3pVP                  VP                  3pR p\        P
                  ! W#VRR7      p\        P                  ! V^ ,          V^,          .RR7      p\        VP                  VP                  4       \        VP                  VP                  RR7       R# )	   F:fmPrH  c                 F    \         P                  ! WVR 7      P                  # r   r  r  s   &&&r&   r   FTestMonteCarloHypothesisTest.test_against_ttest_ind.<locals>.statistic8  r  r)   r?   {Gz?r   Nr  rx   )
r]   r^   r   r  r   r   r  r   r   r   r3   rO   r   r   r   rt   r=  s   &      r&   test_against_ttest_ind3TestMonteCarloHypothesisTest.test_against_ttest_ind3  s    ii##$67zzvz&


(::jj#**$	> $$T	Cood1gQyr:s}}5

CJJT:r)   c                   \         P                  P                  R 4      pVP                  R	R7      VP                  R
R7      VP                  RR7      VP                  RR7      3pVP                  VP                  VP                  VP                  3pR p\        P
                  ! W#VRRR7      p\        P                  ! VRR/ p\        VP                  VP                  4       \        VP                  VP                  RR7       R# )ra  rH  c                 B    \         P                  ! VR V / P                  # r?   )r   f_onewayr   )r@   r  s   $*r&   r   ETestMonteCarloHypothesisTest.test_against_f_oneway.<locals>.statisticG  s    >>43d3===r)   r   r@   r   r@   {Gz?r   Nr  )r,   e   )r,   f   )r,   g   rx   )
r]   r^   r   r  r   r   rj  r   r   r   re  s   &      r&   test_against_f_oneway2TestMonteCarloHypothesisTest.test_against_f_oneway@  s    ii##$67


)3::8:+D


)3::8:+DFjj#**cjj#**<	> $$T	1:<nnd,,s}}5

CJJT:r)   z2Statistic may not depend on sample order on 32-bitc                  a \         P                  P                  R 4      oRpV3R lpV! ^d4      p\        P                  ! W2\         P
                  RVR7      p\         P                  ! VP                  VP                  8*  4      p\         P                  ! VP                  VP                  R,          8*  4      pWV8w  g   Q hVP                  V^,           V^,           ,          8X  g   Q hR# )l   U5<H r  c                 b   < R \         P                  ! RR7      P                  V SR7      ,          # )r  gZd;O?)ry  r   )r   	bernoullir   r   rO   s   &r&   r   ITestMonteCarloHypothesisTest.test_finite_precision_statistic.<locals>.rvsY  s'    %044$S4QQQr)   r   )r   rD   Ng     ?)
r]   r^   r   r   r   r  r  null_distributionr   r   )r3   rD   r   r$   rt   c0c1rO   s   &      @r&   test_finite_precision_statistic<TestMonteCarloHypothesisTest.test_finite_precision_statisticQ  s     ii##$45	R H$$QRVV1<> VVC))S]]:;VVC))S]]G-DDExxzzb1f{Q7777r)   rp   )	two-sidedr   r   )r   r   g      ࿩r   r   r~  rY  )333333?gffffff?g?)%r.   r  r  r  r   r]   r  r  r  r  r/   r  xslowr  r  r\  r  r!  r  linspacer/  r   skewtestkurtosistestr6  ry   r<  rB  r[  r^  rf  rq  	fail_slowr  r{  r  r  r  s   @r&   r  r    s    D(, =@.DP [[#2 #2J [[VU2q\2@ 3@@ [[],LML NL& [[[[],?@[[S"++dC";<K = A K, [[Z%..%:L:L)MN[[],LM[[S"++b!Q"78E 9 N OE" [[S"))B"23E 4E" [[[[S"++dC";<E = E$ [[[[[6:*>?[[/A%B B @ %BN$;;" [[1[[ TU8 V 8r)   r  c                   x  a  ] tR tRt o RR/R ltR t]P                  P                  R 4       t	]P                  P                  R 4       t
]P                  P                  R. ROR	7      R
 4       t]P                  P                  RRR7      ]P                  P                  R. ROR	7      R 4       4       tRtV tR# )	TestPowerif  r  Nc               :   aaa Sf   \        S4      MSoVVV3R l# )Nc                 J   < SP                  SP                  V R 7      SR7      # )rH  r  )r2   r  )r   r  rO   r%   s   &r&   r'   %TestPower.xp_normal.<locals>.<lambda>j  s    BJJszztz'<EJJr)   )r   )r3   rO   r%   r  s   &fddr&   	xp_normalTestPower.xp_normalh  s    (- $5JJr)   c                t   \         P                  P                  R 4      p\        P                  pV P                  W!R7      V P                  W!R7      3pVP                  ^
4      VP                  ^4      3pRp\        P                  ! \        VR7      ;_uu_ 4        \        W4VRR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \        VRV4       RRR4       \        P                  ! \        VR7      ;_uu_ 4        \        W0P                  W!R7      R3V4       RRR4       R	p\        P                  ! \        VR7      ;_uu_ 4        \        W0P                  W!R7      3V4       RRR4       \        P                  ! \        VR7      ;_uu_ 4        \        W4R4       RRR4       R
p\        P                  ! \        VR7      ;_uu_ 4        \        W4V^R7       RRR4       \        P                  ! \        VR7      ;_uu_ 4        \        W4WQP                  R^^24      R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \        W4VRR7       RRR4       Rp\        P                  ! \        \        3VR7      ;_uu_ 4        \        W4VP                  ^
^.4      VP                  . RO4      34       RRR4       \        P                  ! \        \        3VR7      ;_uu_ 4        \        W4VP                  ^
^.4      VP                  ^^.4      3RVP                  . RO4      /R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \        RWE4       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \        W4VRR7       RRR4       \        P                  ! \        VR7      ;_uu_ 4        \        W4VRR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \        W4VRR7       RRR4       \        P                  ! \        VR7      ;_uu_ 4        \        W4VRR7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELU; i  + '       g   i     EL0; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELV; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL{; i  + '       g   i     ELR; i  + '       g   i     R# ; i)l   yB0 1 rT  r9   r   r>   r;   Nr  r:   r  z3`significance` must contain floats between 0 and 1.significancez`kwargs` must be a dictionary)kwargsz6not be broadcast|Chunks do not add|Incompatible shapesr$   z`test` must be callablez(`n_resamples` must be a positive integerrC   g      %@z"`batch` must be a positive integerrG   )r   rx   r*   )r         i)r]   r^   r   r   r  r  r2   r/   r0   rS   r   r1   r  RuntimeError)r3   r%   rO   testr   n_observationsr4   s   &&     r&   r  TestPower.test_input_validationl  s   ii##$78~~c~)4>>#>+EF**R."**R.9D]]:W55$^< 6 E]]9G44$n- 5]]9G44$3V<nM 5 .]]:W55$35~F 6]]:W55$U# 6 H]]:W55$^!< 6]]:W55$^++b!R:PQ 6 2]]9G44$^I> 5 K]]J5WEE$bjj"b2BJJ|4LMN F]]J5WEE$bjj"b2BJJBx4HIrzz)457 F ,]]9G44$, 5 =]]:W55$^= 6]]:W55$^> 6 7]]:W55$^37 6]]:W55$^48 65[ 655 544444 655555 655555 544 FEEEEE
 544 655555 655555s   RR"R6 S
*S%S2 T-T01T.AUUU*=U>:V5V&R	"R3	6S	
S	S/	2T	T	T+	.T?	U	U'	*U;	>V	V#	&V7	c           
       aa \         P                  P                  R 4      pVV3R lo^ Sn        ^ Sn        \        SSP                  ^
4      RR7      p\         P                  P                  R 4      p\        R/ VBRV P                  VSR7      R^/B pSP                  R8X  g   Q hSP                  ^8X  g   Q h\         P                  P                  R 4      p^ Sn        \        R/ VBRV P                  VSR7      R^2/B pSP                  ^8X  g   Q hSP                  ^28X  g   Q h\         P                  P                  R 4      p^ Sn        \        R/ VBRV P                  VSR7      RR/B pSP                  ^8X  g   Q hSP                  R8X  g   Q h\        VP                  VP                  4       \        VP                  VP                  4       R# )	r
  c                   < V P                   ^8X  d   ^MV P                  ^ ,          p\        VSP                  4      Sn        S;P                  ^,          un        \
        P                  ! V SP                  R4      VR7      P                  # )r+   r2  r?   )	r  rz   rB  r  r  r   r  r2   r   )r$   r@   r  r  r%   s   && r&   r  "TestPower.test_batch.<locals>.test  s_    ffkqwwqzJ!*doo>DOLLAL$$Q

2TBIIIr)   r  )r  r  rD   r   rT  rH   Nrp   )
r]   r^   r   r  r  r   r2   r   r  r   )r3   r%   rO   r  re   rf   r  r  s   &f     @r&   r  TestPower.test_batch  s    ii##K0	J
 #%::b> $& ii##K0EtE!;E1E||t###!###ii##K0FtF!;F2F||r!!!"$$$ii##K0HtH!;H4H||q   $&&&

DJJ/

DJJ/r)   c                  aaaa \         P                  P                  R 4      pRR^ R^R/oVP                  ^ R.4      oRVV3R llpVP                  . RO4      RVP                  3,          pRVP                  . RO4      /pVP                  . RO4      p\
        P                  ! W0P                  W!R	7      VWeR
7      p. pV F  p	\        VP                  ^ ,          4       F  p
WJR3,          pVR,           F}  o\        SP                  ^ ,          4       FZ  pSV,          oRVVV3R llp\
        P                  ! WP                  W!R	7      VV	R7      pVP                  VP                  4       K\  	  K  	  K  	  K  	  VP                  VP                  V4      VP                  P                  4      p\        VP                  VRRR7       R# )l   x7'\r   r~  r   皙?c           
         < \         P                  ! S\        \        ^V P                  ^,           4      4      R7      pS\        V4      ,          p\        P                  ! WVVR7      # )r+   r?   r   r@   )xpxexpand_dimsrT   r\  r  r   r   r  )r$   r   r@   popmeans_expandedalternativespopmeanss   &&& r&   r  *TestPower.test_vectorization.<locals>.test  sU     #5:5AFFQJ;O5P!R&s;'78K$$Q{*.0 0r)   rU  r   rm  rT  r  r  .c           	      X   < \         P                  ! V SVS\        S4      ,          R 7      # )rl  )r   r  r   )r$   r@   alternative_ir  	popmean_js   &&r&   test2+TestPower.test_vectorization.<locals>.test2  s+    #(#4#4Q	,8]9K,L$N Nr)   r  rd  )r   r   Nrx   rw   )r   r   rv  r   r   )rx   r   r+   )rm  r  皙?r   )r]   r^   r   r2   r  r   r   r  r\  rz   appendr   r   r   )r3   r%   rO   r  nxr  r  rt   r=  significance_irq   nx_ijr  tmpr  r  r  r  s   &&             @@@@r&   test_vectorizationTestPower.test_vectorization  s    ii##N3FAk1i@ ::q#h'	0 	0 ZZ-.q"**}=J!78 zz":;kk$s :B'3D *N288A;'S&z%+M%:%:M"8>>!#45$,QK	N N $kk%1KT7EG

399- 6 &; ( + jj#		8 			3T=r)   Tcpu_onlyr  c           	     0   \         P                  P                  R 4      p\        P                  pVP                  VP                  ^
^d^
R7      4      VP                  VP                  ^
^d^
R7      4      3pV P                  W!R7      V P                  W!R7      3pVP                  . RO4      p\        P                  ! W5WFR7      pVP                  VRVP                  3,          VP                  P                  4      p\        VP                  VRR7       R# )	   &( rH  rT  rm  r  rU  r   N)rm  r  r   )r]   r^   r   r   r  r2   integersr  r   r   r  rz   r   )r3   r%   rO   r  r  r   r  rt   s   &&      r&   test_ttest_ind_nullTestPower.test_ttest_ind_null  s    
 ii##O4**S\\"c\%EF**S\\"c\%EFHnnSn($...*DDzz"34kk$^O|ArzzM'BCIIOOT		<d;r)   rc  z+currently combines integer and float arraysr   c                   \         P                  P                  R 4      p. RO. R	O.. R
O. RO..pRVP                  . RO4      /pVP                  ^
.^..4      pVP                  RR.4      p\        P
                  ! \        P                  V P                  W!R7      VWdR7      p\        VP
                  VP                  V4      RR7       R# )r  r  rm  r  rT  r  r   N)gv?g]NbJ?g6;?)gOt]?g7gLڷ?g0Dҗ?)gVL[?g;c?g.H&?)g#*3)?glk?g5i ?)r   r  r   )	r]   r^   r   r2   r   r   r  r  r   )r3   r%   rO   r=  r  r  r  rt   s   &&      r&   test_ttest_1samp_power TestPower.test_ttest_1samp_power  s     ii##O4 5464467
 RZZ89bTB4L1zz4,/kk%++T^^C^-G'3D		2::c?>r)   rp   )r  	jax.numpyz
dask.array)r.   r  r  r  r  r  r/   r  r  r  r  r   r  r  r  r  r  s   @r&   r  r  f  s     K$ K79r [[#0 #0J [[*> *>X [[!!4-P " R<R< [[!!"4)V " X[[!!4-P " R?RX?r)   r  c                   V
  a  ] tR tRt o RtR tR t]P                  P                  R]
P                  P                  ]
P                  P                  .4      ]P                  P                  R. RDO4      R	 4       4       t]P                  P                  R]
P                  P                  ]
P                  P                  .4      ]P                  P                  R
R]P                   ! ^4      ^,          3RER]P"                  ! ^^4      3.4      R 4       4       tR t]P                  P)                  4       R 4       t]P                  P-                  RRR.R7      R 4       t]P                  P-                  RR7      ]P                  P                  RRF4      R 4       4       t]P                  P-                  RR7      ]P                  P                  RRF4      R 4       4       t]! RRR7      ]! RR7      ]P                  P                  RRF4      R 4       4       4       t]! RRR7      ]! RR7      ]! RR7      R 4       4       4       t]! RRR7      ]! RR7      ]P                  P                  RRG4      R 4       4       4       t]P                  P-                  RR7      ]P                  P                  RRF4      R  4       4       t]P                  P                  RRF4      R! 4       t]P                  P-                  RR7      R" 4       t]P                  P                  RRF4      R# 4       t ]P                  PC                  4       ]P                  P                  RRH4      R$ 4       4       t"R%. RIOR&. RJOR'R(R)R*R+R,R-R.R/R0R1R2/t#R%. RKOR&. RLOR'R3R)R4R+R5R-R6R/R7R1R8/t$]P                  P-                  RR7      ]P                  PC                  4       ]P                  P                  R9]#]$34      R: 4       4       4       t%]P                  P(                  ]P                  P                  R;RM4      ]P                  P-                  RRR.R7      ]P                  P-                  RR7      R< 4       4       4       4       t&]P                  P                  R=RN4      R> 4       t'](! ^ 4      ^. 3](! ^4      ^. ROO. RPO.3](! ^4      ^. ROO. RPO^^..3.t)]P                  P                  R?])4      R@ 4       t*]P                  PW                  ^4      ]P                  P-                  RRR.R7      RA 4       4       t,RBt-V t.RC# )QTestPermutationTesti"  r   c                N    \         P                  P                  R 4      V n        R# )l   F N)r]   r^   r   rO   )r3   s   &r&   setup_method TestPermutationTest.setup_method'  s    99(()<=r)   c                    R  pVP                  . RO4      VP                  . RO4      3pRp\        P                  ! \        VR7      ;_uu_ 4        \	        V^ ,          VP                  ^ .4      3V4       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        RV4       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \	        ^V4       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2R	R
7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        W2R	R7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \	        W2RR7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL|; i  + '       g   i     ELW; i  + '       g   i     EL/; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELg; i  + '       g   i     EL?; i  + '       g   i     EL; i  + '       g   i     R# ; i)c                 F    \         P                  ! W3V4      P                  # r    r  r  s   &&&r&   r  :TestPermutationTest.test_permutation_test_iv.<locals>.stat-  s    ??A640:::r)   z2each sample in `data` must contain two or more ...r   Nz6`data` must be a tuple containing at least two samplesr=   r>   r?   z `permutation_type` must be in...r:   permutation_typer9   r;   r  rC   rE   rF   rG   r  r  rL   rM   rN   r*   r  rR   )r2   r/   r0   rS   r   r1   )r3   r%   r  r   r4   s   &&   r&   test_permutation_test_iv,TestPermutationTest.test_permutation_test_iv+  s   	; 

9%rzz)'<=F]]:W55d1grzz1#7> 6 K]]:W55T4( 6]]9G44Q% 5 /]]:W55Tc2 6 5]]:W55T.46 6 E]]:W55TC8 6 >]]:W55TU; 6 >]]:W55TV< 6 @]]:W55Tu5 6 @]]:W55Tv6 6 0]]:W55TV< 6 A]]9G44TY7 54W 655 655444 655 655
 655 655 655 655 655 655 544s   &L$L$L8MM M4NNN0 O<O8O,L!	$L5	8M		M	 M1	4N	N	N-	0O	O	O)	,O=	r\   r  pairingsindependentc           	     >  aa
 SP                  V P                  P                  ^
4      4      pSP                  V P                  P                  ^
4      4      pV
V3R lo
^ S
n        ^ S
n        RRRVRR/p\
        P                  ! WE3S
3R^RV! ^ 4      /VB pS
P                  R	8X  g   Q hS
P                  ^8X  g   Q h^ S
n        \
        P                  ! WE3S
3R^2RV! ^ 4      /VB pS
P                  ^8X  g   Q hS
P                  ^28X  g   Q h^ S
n        \
        P                  ! WE3S
3RRRV! ^ 4      /VB p	S
P                  ^8X  g   Q hS
P                  R8X  g   Q h\        VP                  V	P                  4       \        VP                  V	P                  4       R
# )r   c                 
  < V P                   ^8X  d   ^MV P                  ^ ,          p\        VSP                  4      Sn        S;P                  ^,          un        SP                  WR7      SP                  WR7      ,
          # r)  )r  rz   rB  r  r  r"   )r$   rl   r@   r  r   r%   s   &&& r&   r   1TestPermutationTest.test_batch.<locals>.statisticm  sc    ffkqwwqzJ#&z93G3G#HI "7717(27717+@@@r)   rD   r  r  r<   TrH   r\   r  N)	r2   rO   r^   r  r  r   r   r   r   )r3   r  r\   r%   r$   rl   r  re   rf   r  r   s   &&&f      @r&   r  TestPermutationTest.test_batchc  s    JJtxxr*+JJtxxr*+	A
 	 	t%79Id$%%qfi Lq L3??LFJL  D(((##q(((	%%qfi Lr L3??LFJL  B&&&##r)))	%%qfi Lt L3??LFJL  A%%%##t+++T[[1T[[1r)   zpermutation_type, exact_sizec           	       a SP                  V P                  P                  ^4      4      pSP                  V P                  P                  ^4      4      pV3R lpRVRR/p\        P                  ! WV3V3R^RV! ^ 4      /VB p	\        V	P                  4      ^8X  g   Q h\        P                  ! WV3V3/ VB p	\        V	P                  4      V8X  g   Q hR# )r-   c                 V   < SP                  WR 7      SP                  WR 7      ,
          # r   r!   rk   s   &&&r&   r   8TestPermutationTest.test_permutations.<locals>.statistic  r   r)   r  r<   TrD   r\   N)r2   rO   r^   r   r   r	   rx  )
r3   r  
exact_sizer\   r%   r$   rl   r   r  rt   s
   &&&&f     r&   test_permutations%TestPermutationTest.test_permutations  s     JJtxxq)*JJtxxq)*	A #$4d$$$aVY KA K2>q/KEIKs,,-222$$aVY?$?s,,-;;;r)   c           
       a R ^ r2^^	Rrep\         P                  ! WE,           V4      V8  g   Q h\        P                  P	                  R4      pSP                  VP                  VR7      4      pSP                  VP                  VR7      4      pWx3p	V3R lp
RRRRR	^dR
VRV/p\        W3RV/VB p\        W3RSP                  /VB pVP                  VP                  8X  g   Q h\        VP                  VP                  RR7       R# )r   i]     U rH  c                 V   < SP                  WR 7      SP                  WR 7      ,
          # r   r!   rk   s   &&&r&   r   NTestPermutationTest.test_randomized_test_against_exact_both.<locals>.statistic  r   r)   r<   Tr  r  rH   r   rO   rD   rm  r   N)r   binomr]   r^   r   r2   r  r   infr   r   r   r3   r%   r   rO   r  nypermutationsr$   rl   r   r   r  rt   rf   s   &f            r&   'test_randomized_test_against_exact_both;TestPermutationTest.test_randomized_test_against_exact_both  s    "1S !U}}RWb)L888ii##J/JJs***34JJs***34t	A d$6m[%FtQLQDQLRVVLtL}}...

DKKd;r)   c           
       a R Rr2^^Rrep^V,          V8  g   Q h\         P                  P                  R4      pSP                  VP	                  VR7      4      pSP                  VP	                  VR7      4      pWx3p	V3R lp
RRRR	R
^dRVRV/p\        W3RV/VB p\        W3RSP                  /VB pVP                  VP                  8X  g   Q h\        VP                  VP                  RR7       R# )r   Ni }  r  rH  c                 6   < SP                  W,
          VR 7      # r   r!   rk   s   &&&r&   r   QTestPermutationTest.test_randomized_test_against_exact_samples.<locals>.statistic  s    7715t7,,r)   r<   Tr  samplesrH   r   rO   rD   rm  r   )
r]   r^   r   r2   r  r   r  r   r   r   r  s   &f            r&   *test_randomized_test_against_exact_samples>TestPermutationTest.test_randomized_test_against_exact_samples  s    
 %dS!2u"u|###ii##J/JJs***34JJs***34t	- d$6	m[%FtQLQDQLRVVLtL}}...

DKKd;r)   Tr  r  r  c           
       a R V P                   r2^^Rrep\        P                  ! V4      V8  g   Q h\        P                  P                  R4      pVP                  VP                  VR7      4      pVP                  VP                  VR7      4      oV.pV3R lp	RRRRR	^dR
VRV/p
\        W3RV/V
B p\        W3RVP                  /V
B pVP                  VP                  8X  g   Q h\        VP                  VP                  RR7       R# )r~  i@  r  rH  c                 J   < \         P                  ! V SVR 7      P                  # r   )r   pearsonrr   )r$   r@   rl   s   &&r&   r   RTestPermutationTest.test_randomized_test_against_exact_pairings.<locals>.statistic  s    >>!QT2<<<r)   r<   Tr  r  rH   r   rO   rD   rm  r   N)rO   r   	factorialr]   r^   r   r2   r  r   r  r   r   r   )r3   r%   r   rO   r  r  r  r$   r   r   r  rt   rf   rl   s   &&           @r&   +test_randomized_test_against_exact_pairings?TestPermutationTest.test_randomized_test_against_exact_pairings  s   
 'S !U  $|333ii##J/JJs***34JJs***34s	= d$6	m[%FtQLQDQLRVVLtL}}...

DKKd;r)   )
eager_onlyr   c                @  aa V P                   P                  ^^R7      pV P                   P                  ^^^R7      p\        P                  ! W4SRR7      pVV3R lpSP	                  V4      SP	                  V4      rC\        W43V\        P                  RV P                   R7      p\        VP                  SP	                  VP                  4      V P                  R7       \        VP                  SP	                  VP                  4      V P                  R7       R	# )
rQ   r   r   )r   r   r   exact)r   r'  c                    < \        V 4      \        V4      r\        P                  ! WVR SR7      pSP                  VP                  4      pVP
                  ^ 8X  d
   VR,          # T# )r&  )r@   r'  r   rp   )r   r   ks_2sampr2   r   r  )r$   rl   r@   rt   r   r%   s   &&& r&   r   <TestPermutationTest.test_against_ks_2samp.<locals>.statistic  sT    $Q'):1)=q..DwKXC**S]]+C!hh!m3r744r)   r   rD   r   rO   r   N)rO   r  r   r  r2   r   r]   r  r   r   r   r   r3   r   r%   r$   rl   r   r   rt   s   &ff     r&   test_against_ks_2samp)TestPermutationTest.test_against_ks_2samp  s     HHOO!O,HHOOO3>>!KgN	5 zz!}bjjm1vybff+4$((D 	rzz(2D2D'EDIIV

BJJx$?diiPr)   c                V  a V P                   P                  ^^R7      pV P                   P                  ^^R7      pRRRRRR/pWQ,          p\        P                  ! W4VR7      pV3R lpSP	                  V4      SP	                  V4      rC\        W43V\        P                  WP                   R7      p	\        V	P                  SP	                  VP                  4      V P                  R7       \        V	P                  SP	                  VP                  4      V P                  R7       R	# )
rQ   r  r   r   r~  r  c                    < \        V 4      \        V4      r\        P                  ! WVR 7      pSP                  VP                  4      pVP
                  ^ 8X  d
   VR,          # T# r?   rp   r   r   ansarir2   r   r  r$   rl   r@   rt   r%   s   &&& r&   r   :TestPermutationTest.test_against_ansari.<locals>.statistic!  P    $Q'):1)=q,,q$/C**S]]+C!hh!m3r744r)   r  r   N)rO   r  r   r  r2   r   r]   r  r   r   r   r   )
r3   r   r%   r$   rl   alternative_correspondencealternative_scipyr   r   rt   s
   &&f       r&   test_against_ansari'TestPermutationTest.test_against_ansari  s     HHOO!O,HHOO!O, '-i&/&1;&@" 7C<<2CD	5 zz!}bjjm1vybff+6HHF 	rzz(2D2D'EDIIV

BJJx$?diiPr)   zneeds mannwhitneyur   c           
     j   \         P                  P                  R	^ V P                  R7      p\         P                  P                  R	RV P                  R7      p\         P                  ! W4^VR7      pR pVP                  V4      VP                  V4      rC\        W43VRVP                  V^V P                  R7      p\        VP                  VP                  VP                  4      V P                  R7       \        VP                  VP                  VP                  4      V P                  R7       R# )
r-   r   r   r\   r  rl  c                 H    \         P                  ! WVR R7      P                  # 
asymptotic)r@   rJ   )r   mannwhitneyur   r  s   &&&r&   r   @TestPermutationTest.test_against_mannwhitneyu.<locals>.statistic8  s    %%alKUUUr)   T)r<   rD   r   r@   rO   r   N)r-   rW  r,   )r   uniformr   rO   r  r2   r   r  r   r   r   r   r  s   &&&     r&   test_against_mannwhitneyu-TestPermutationTest.test_against_mannwhitneyu/  s     MM9!$((KMM9$TXXN%%aL	V zz!}bjjm1vyT+-66{$%4885 	rzz(2D2D'EDIIV

BJJx$?diiPr)   zneeds cramervonmises_2samp)r  c                n   \         P                  P                  ^^V P                  R7      p\         P                  P                  ^^^V P                  R7      p\         P                  ! W#RR7      pR pVP                  V4      VP                  V4      r2\        W#3V\        P                  RV P                  R7      p\        VP                  VP                  VP                  4      V P                  R7       \        VP                  VP                  VP                  4      V P                  R7       R	# )
rQ   )r   r   r\   )r   r   r   r\   r  rI   c                 L    \         P                  ! WVR R7      pVP                  # r	  )r   cramervonmises_2sampr   )r$   rl   r@   rt   s   &&& r&   r   7TestPermutationTest.test_against_cvm.<locals>.statisticL  s     ,,Q\RC== r)   r   r  r   N)r   r   r   rO   r  r2   r   r]   r  r   r   r   r   )r3   r%   r$   rl   r   r   rt   s   &&     r&   test_against_cvm$TestPermutationTest.test_against_cvmC  s     JJNNNBJJNNqNI--a7C	!
 zz!}bjjm1vybff+4$((D 	rzz(2D2D'EDIIV

BJJx$?diiPr)   zneeds kruskalr@   c                "   \         P                  P                  R 4      pVP                  ^R7      pVP                  RR7      pVP                  RR7      pWEV3p\        P                  ! VRV/ pR p	RVRRRRRV/p
V Uu. uF  qP                  V4      NK  	  pp\        Wy3R	VP                  /V
B p\        Wy3R	R
/V
B p\        VP                  VP                  VP                  4      V P                  ^,          R7       \        VP                  VP                  V P                  ^,          R7       \        VP                  VP                  VP                  4      RR7       \        VP                  VP                  RR7       R# u upi )l   Y}y!dh rH  r@   c                 B    \         P                  ! VR V / P                  # r?   )r   kruskalr   r  s   $*r&   r   GTestPermutationTest.test_vectorized_nsamp_ptype_both.<locals>.statistico  s    ==$2T2<<<r)   r   r   r  r  rO   rD   r  r   gQ?r   r   N)r+   r-   r,   )r,   r+   rQ   )r]   r^   r   r   r  r2   r   r  r   r   r   r   )r3   r@   r%   rO   r$   rl   r   r   r   r   r  data_rt   rf   s   &&&           r&    test_vectorized_nsamp_ptype_both4TestPermutationTest.test_vectorized_nsamp_ptype_bothX  sH    ii##$78JJQJ JJIJ&JJIJ&ay==$2T2	= mY"M5#?/34te

5!t4tKBFFKdKJTJTJ 	rzz(2D2D'EDIIVWKXt~~DIIaKH

BJJx$?dK

DKKd; 5s   Fc           
     z  a \         P                  P                  R^ V P                  R7      p\         P                  P                  RRV P                  R7      p\         P                  ! W4V^R7      pV3R lpV3R lpSP                  V4      SP                  V4      rCR^RVRR	R
V P                  R\        P                  /p\        W4,
          3V3/ VB p	\        W43V3/ VB p
\        V	P                  V
P                  V P                  R7       VR8w  d<   \        V
P                  SP                  VP                  4      V P                  R7       \        V
P                  SP                  VP                  4      V P                  R7       \        V	P                  V
P                  V P                  R7       R# )r-   r  r  r  c                    < \        V 4      p \        P                  ! V R VR7      pSP                  VP                  4      pVP
                  ^ 8X  d
   VR,          # T# r   r  rp   r   r   wilcoxonr2   r   r  )r   r@   rt   r%   s   && r&   statistic_1samp_1dETestPermutationTest.test_against_wilcoxon.<locals>.statistic_1samp_1d  sL     "!$A..TBC**S]]+C!hh!m3r744r)   c                    < \        V 4      \        V4      r\        P                  ! WR VR7      pSP                  VP                  4      pVP
                  ^ 8X  d
   VR,          # T# r  r   r  s   &&& r&   statistic_2samp_1dETestPermutationTest.test_against_wilcoxon.<locals>.statistic_2samp_1d  sR    $Q'):1)=q..6EC**S]]+C!hh!m3r744r)   r@   r   r  r  rO   rD   r   r~  N)r-   rX  r,   )r   r  r   rO   r!  r2   r]   r  r   r   r   r   r   )r3   r   r%   r$   rl   r   r"  r%  r  re   rf   s   &&f        r&   test_against_wilcoxon)TestPermutationTest.test_against_wilcoxon  sK    MM9!$((KMM9$TXXN>>!KaH	5	5 zz!}bjjm1=+7I9txx8(:CdC(:CdC 	TYYG+%DNNBJJx7I7I,J!%, 	RZZ%@tyyQT[[tyyAr)   c           
        V P                   P                  ^ ^^
R7      pRW3^ 8H  &   RR lpV! V4      ^
Rrvp\        P                  ! WVWqR7      p\        P                  ! VP                  W2P                  R7      3VRRVP                  V P                   VR7      p	\        V	P                  VP                  VP                  4      V P                  R	7       R
# )r   rH  c                 D    \        V 4      pVP                  V ^ 8  VR7      # )r   r?   )r
   r   )r$   r@   xp_s   && r&   r   =TestPermutationTest.test_against_binomtest.<locals>.statistic  s&    !!$C$$QU$66r)   r  r  r  Tr  )r<   r  rD   rO   r   r   Nrx   r   )rO   r  r   r   r   r2   r  r  r   r   r   )
r3   r   r%   r$   r   kr{   ry  r   rt   s
   &&&       r&   test_against_binomtest*TestPermutationTest.test_against_binomtest  s     HHa,q&	
	7 A,Ca??1D$$bjj**j&E%G046?RVV)-{L 	

BJJx$?diiPr)   c                &  aa V P                   P                  ^R7      pW P                   P                  ^R7      ,           o\        P                  ! VSRR7      pVV3R lpSP	                  V4      p\        V3VR\        P                  V P                   R7      p\        VP                  SP	                  VP                  4      V P                  R7       \        VP                  SP	                  VP                  4      V P                  R7       R# )	rX  rH  r  rI   c                    < \        V 4      p \        P                  ! V SR VR7      pSP                  VP                  4      pVP
                  ^ 8X  d
   VR,          # T# )r
  )rJ   r@   rp   )r   r   
kendalltaur2   r   r  )r$   r@   rt   r%   rl   s   && r&   r   >TestPermutationTest.test_against_kendalltau.<locals>.statistic  sN    !!$A""1a4HC**S]]+C!hh!m3r744r)   r  )r  rD   rO   r   N)rO   r  r   r2  r2   r   r]   r  r   r   r   r   )r3   r%   r$   r   r   rt   rl   s   &f    @r&   test_against_kendalltau+TestPermutationTest.test_against_kendalltau  s    HHOOO#Q''##Aq9	5 JJqMtY+-66txxA 	rzz(2D2D'EDIIV

BJJx$?diiPr)   c           	     ~  aa	 \         P                  P                  R 4      pVP                  ^4      R8  P                  \        4      pVP                  ^4      RV,          ,           R8  P                  \        4      o	\
        P                  P                  VS	4      ^,          pSP                  V4      SP                  S	4      upo	VV	3R lp\        V3VRSP                  VVR7      p\
        P                  ! WQR7      p\        VP                  SP                  VP                  VP                  R7      4       R# )	l   	(yM4 r  g      ?c                 D   < SP                  V ^8H  S^8H  ,          VR7      # r)  )r   r$   r@   r%   rl   s   &&r&   r   @TestPermutationTest.test_against_fisher_exact.<locals>.statistic  s&    ##Q!VQ$7d#CCr)   r  )r  rD   r   rO   r  r  N)r]   r^   r   r!  r   r   contingencycrosstabr2   r   r  fisher_exactr   r   r  )
r3   r   r%   rO   r$   tabr   rt   rf   rl   s
   &&f      @r&   test_against_fisher_exact-TestPermutationTest.test_against_fisher_exact  s     ii##$78ZZ]S ((/ZZ]T!V#c)11%8((A.q1zz!}bjjm1	D tY+-66{#&( !!#?

BJJt{{!''J$JKr)   c           
        V P                   P                  RR7      pV P                   P                  RR7      pV P                   P                  RR7      p\        P                  ! W!R7      p\        P                  ! W1R7      p\        P                  ! WAR7      pV^ ,          pW#V3pR pR p\        P
                  ! V4      p\        P
                  ! V4      p	V! \        P                  ! V!  RV/ p
V	! \        P                  ! V!  RV/ pRRRVRR	R
RR^ /p\        WV3R\        P                  /VB p\        WV3RR/VB p\        VP                  WP                  R7       \        VP                  VP                  V P                  R7       \        VP                  WP                  R7       \        VP                  VP                  RR7       R# )r,   rH  r?   c                  H    \         P                  ! V R RR7      P                  # )Tr
  rankedrJ   )r   page_trend_testr   r   s   *r&   r*  LTestPermutationTest.test_vectorized_nsamp_ptype_samples.<locals>.statistic1d  s"    ((d0<>>GiHr)   c                  H    \         P                  ! V R RR7      P                  # )Tr  rB  )r   rD  r   rE  s   *r&   pvalue1dITestPermutationTest.test_vectorized_nsamp_ptype_samples.<locals>.pvalue1d  s"    ((d0799?@r)   r@   r<   Fr   r   r  r  rO   rD   r   r   r   r   N)r,   rQ   r-   )r+   rQ   r-   )r,   rQ   r+   )rO   r^   r   rankdatar   r  r]   broadcast_arraysr   r  r   r   r   r   )r3   r@   r$   rl   r   r   r*  rH  r   r   expected_statisticexpected_pvaluer  rt   rf   s   &&             r&   #test_vectorized_nsamp_ptype_samples7TestPermutationTest.test_vectorized_nsamp_ptype_samples  s{    HHOOO+HHOOO+HHOOO+NN1(NN1(NN1(aDay	H	@  44[A	11(;&(;(;T(BNN ""5"5t"<H4H eVT=)"Jq:tMbffMMLtLtL'9		Jt~~DIIF

O))D

DKKd;r)   r$   rl   expected_lessr  expected_2sidedg?expected_Pr_gte_S_meang&_?rL  g      @expected_avggd~$I"@expected_stdglu?gd?gd?gYo5 ?g     @@@g{C@gDmFA@casec           	       a VR,          pVR,          pSP                  VR,          4      pSP                  VR,          4      pSP                  VR,          4      pSP                  VR,          4      pSP                  VR,          4      p	SP                  VR,          4      p
V3R	 lp\        S4      pSP                  W<R
7      SP                  WLR
7      rC\        P                  ! 4       ;_uu_ 4        \        P                  ! RR\
        4       \        W43V\        P                  RR7      p\        W43V\        P                  RR7      pRRR4       \        XP                  WPP                  R7       \        VP                  VRR7       \        XP                  VRR7       \        SP                  VP                  4      V	RR7       \        SP                  VP                  4      V
RR7       VP                  pSP                  VP                  4      pVP                  P                   ^ ,          pSP#                  SP%                  SP'                  VP                  V,
          4      SP'                  VV,
          4      8  4      VP(                  4      V,          p\        VV4       R#   + '       g   i     ELm; i)a.  
Results above from SAS PROC NPAR1WAY, e.g.

DATA myData;
INPUT X Y;
CARDS;
1 1
1 2
1 3
1 4
2 1.5
2 2
2 2.5
ods graphics on;
proc npar1way AB data=myData;
    class X;
    EXACT;
run;
ods graphics off;

Note: SAS provides Pr >= |S-Mean|, which is different from our
definition of a two-sided p-value.

r$   rl   rL  rP  rQ  rR  rS  rT  c                    < \        V 4      \        V4      r\        P                  ! WVR 7      pSP                  VP                  4      pVP
                  ^ 8X  d
   VR,          # T# r  r  r  s   &&& r&   r   5TestPermutationTest.test_with_ties.<locals>.statisticM  r  r)   r  r0  z$Ties preclude use of exact statisticr   )rD   r   r~  Nr   g|=r   r  )r2   r   rR  rS  r  UserWarningr   r]   r  r   r   r   r   r"   rx  r   rz   r!  r   r   r  )r3   rU  r%   r$   rl   rL  rP  rQ  rR  rS  rT  r   r  rt   rf   Sr"   r{   Pr_gte_S_means   &&f                r&   test_with_ties"TestPermutationTest.test_with_ties&  s%   : IIZZ-A(BC

4#89**T*;%<=!#D1I,J!Kzz$~"67zz$~"67	5 !$zz!z)2::a:+E1$$&&##@+O"A69"&&/57C#QFI2660;=D ' 	'9		J

M>_5A 6 67DQt5564P MMwws,,-!!''*		""2"2FF3((-."&&4.@#BCD77LNOP'=>) '&&s   5AJ22K	zalternative, expected_pvaluec                  aa SP                  . R	O4      pSP                  . R
O4      oRpSP                  \        P                  ! \        S4      4      4      oVV3R lp\	        V3VRSP
                  VR7      p\        VP                  SP                  V4      V P                  R7       \        VP                  SP                  V4      RR7       R# )a  
Results above from R cor.test, e.g.

options(digits=16)
x <- c(1.76405235, 0.40015721, 0.97873798,
       2.2408932, 1.86755799, -0.97727788)
y <- c(2.71414076, 0.2488, 0.87551913,
       2.6514917, 2.01160156, 0.47699563)
cor.test(x, y, method = "spearm", alternative = "t")
g?c                    < SP                  \        P                  ! \        V 4      VR 7      4      p \        P                  ! V SVR 7      P
                  # r   )r2   r   rJ  r   r  r   r8  s   &&r&   r   BTestPermutationTest.test_against_spearmanr_in_R.<locals>.statistic  s=     

5>>*;A*>TJKA>>!QT2<<<r)   r  )r  rD   r   r   gvIh%<=r   N)g@9?gY,?gOQ?g[iY@g|?g鈶BE)gQGn@gU?gz˱@?gmGA6@gB @g˭?)
r2   r   rJ  r   r   r  r   r   r   r   )	r3   r   rM  r%   r$   rL  r   rt   rl   s	   &&&f    @r&   test_against_spearmanr_in_R/TestPermutationTest.test_against_spearmanr_in_Rl  s    . JJ < =JJ ; </JJu~~&7&:;<	= tY+-66{L 	rzz2D'EDIIV

BJJ$?eLr)   rH   c                    \         P                  ! \        R R7      ;_uu_ 4        \        \        P
                  ! . ROV4      4       RRR4       R#   + '       g   i     R# ; i)z`batch` must be positive.r   Nr*   )r/   r0   rS   r   r   _batch_generator)r3   rH   s   &&r&   test_batch_generator_iv+TestPermutationTest.test_batch_generator_iv  s9    ]]:-HII--i?@ JIIIs   #AA#	ziterable, batch, expectedc                T    \        \        P                  ! W4      4      pWC8X  g   Q hR # r    )r   r   rd  )r3   iterablerH   r   gots   &&&& r&   test_batch_generator(TestPermutationTest.test_batch_generator  s#     ;//@Ar)   c                   VP                  . ROVP                  R7      pVP                  . ROVP                  R7      pR p\        P                  ! W#3VRR7      pVP                  VP
                  VP                  rp^\        VP                  WR,
          8  4      4      ,          VP                  ^ ,          ,          p	Yyu;8X  d	   R	8X  g   Q h Q hR# )
r  r  c                 @    \         P                  ! WVR 7      ^ ,          # r   )r   r  r  s   &&&r&   r   FTestPermutationTest.test_finite_precision_statistic.<locals>.statistic  s    >>!T2155r)   r  r  r   N)r  r  r  r  )r  r  g      @g       @gUUUUUU?)
r2   r  r   r   r   r   rx  r   r   rz   )
r3   r%   r$   rl   r   rt   rr   null	correct_ps
   &&        r&   r{  3TestPermutationTest.test_finite_precision_statistic  s     JJ'rzzJ:JJ'rzzJ:	6 $$aVY6@B--S5J5J4b..t5y/@ABBTZZPQ]R	)c)))))r)   rN   N)r  r  r  )r  r  r  )rx   r,   )rY  r+   rP   )r>   r,   g      @)o   k   r   c   ro  j   m   l   )	rt  rx  rv  b   i   rp  n   rz  h   ))r   g?)r   gOO?)r~  g<OO?)rx   r   r  )r-   rQ   rW  )/r.   r  r  r  r   r  r  r/   r  r  r]   r^   r_   r   r  r   r  r  r  r  r  r  r   r  r  r  r  r  r  r'  r.  r4  r>  r  rN  
tie_case_1
tie_case_2r\  ra  re  r\  batch_generator_casesrj  r  r{  r  r  r  s   @r&   r  r  "  s     D>48p [[^bii.C.C.0ii.C.C.E F[[/CE"2EF"2J [[^bii.C.C.0ii.C.C.E F[[;)7+<+<Q+?+BC/,gmmAq.ABDE<	EF<4<2 [[< <4 [[!!4V[<Q!R< S<6 [[!!T!2[[],LMQ N 3Q, [[!!T!2[[],LMQ N 3Q2 f%9:&[[],LMQ N ' ;Q" f%AB&t$Q % ' CQ$ f_5&[[VW-"< . ' 6"<L [[!!T!2[[],LM#B N 3#BJ [[],LMQ NQ. [[!!T!2Q 3Q* [[],LML NL$ [[[[VW-)< . )<Z |S-!<#S*L& (NGEJ >C!<#\*L& )^XGJ [[!!T!2[[[[Vj*%=>A? ?  3A?F [[[[;>?
 [[!!4V[<Q!R[[!!T!2!M 3 S? !MF [[Wg.A /A $Ah2.#AhIy+AB#AhIy1a&+IJL [[8244 [[1[[!!4V[<Q!R* S *r)   r  c                     \         P                  ! . RO\        R7      p \         P                  ! V 4      p\	        4       p^ p\
        P                  ! V 4       FX  pV^,          p\         P                  ! WARR 4      pTP                  \        V Uu. uF  p\        V4      NK  	  up4      4       KZ  	  \         P                  ! \        \        V 4      ^,
          4       Uu. uF7  p\        P                  ! \!        WR 4      \!        W^,           R 4      4      NK9  	  up4      p\#        W74       \#        \        V4      V4       R# u upi u upi )r-   r  N)r-   r,   rQ   rx   )r]   r  r   cumsumsetr   _all_partitions_concatenatedsplitaddrT   	frozensetprodr\  r   r   r  r  r   )r{   ncall_partitionsr  partition_concatenatedpartitioningrq   r   s           r&    test_all_partitions_concatenatedr    s    	#&A	1BUNG"-"J"J1"M1xx 63B@5!E1)A,!EFG #N
 ww!&s1vax2!0A  c!B%j#a!g,?!02 3H #^$h/ "F2s   E =Efun_namec           	      x  aa \         P                  P                  R 4      oSP                  ^
R7      oV3R lpRRS3RSRR/RRS3RSR	R
/RRSRV//pR^d/p\        \        V 4      pW ,          pVP                  V4       V3R lpV! RRVRR/VB  V! RRVRR/VB  R pV! RRVRR/VB  V! RRVRR/VB  R# )l   r: rH  c                 F   < \         P                  P                  V SR 7      # )r   )r   r   r   rv  s   &r&   r   &test_parameter_vectorized.<locals>.rvs  s    zz~~4c~::r)   r   r   rO   rJ   rY   r   r  r  r   rU   r   rD   c                    < V P                   ^8  g    \        P                  ! V S4      '       g   Q h\        P                  ! WR7      # r)  )r  r]   array_equalr"   )r$   r@   rU   s   &&r&   r   ,test_parameter_vectorized.<locals>.statistic  s3    vvzR^^Av6666wwq$$r)   r   r<   NTc                 T    V P                   ^8X  g   Q h\        P                  ! V 4      # r  )r  r]   r"   r*  s   &r&   r   r    s     vv{{wwqzr)   Frp   )r]   r^   r   rf  r   r   )	r  r   fun_optionscommon_optionsrM  optionsr   rO   rU   s	   &      @@r&   test_parameter_vectorizedr    s   
 ))


/CZZRZ F; &E3!)<!9%	5#(:I(G%&%'E	GK
 $S)N
%
"C#GNN>"% 8)8888)888 8)8889)999r)   c                   &   a  ] tR tRt o R tRtV tR# )TestMonteCarloMethodi  c                   R p\         P                  P                  R4      p\        P                  ! \
        VR7      ;_uu_ 4        \        P                  ! VP                  VR7       RRR4       R#   + '       g   i     R# ; i)z.Use of `rvs` and `rng` are mutually exclusive.ir   )r   rO   N)r]   r^   r   r/   r0   rS   r   MonteCarloMethod)r3   r4   rO   s   &  r&   test_rvs_and_random_state.TestMonteCarloMethod.test_rvs_and_random_state  sO    Bii##H-]]:W55""szzs; 6555s   #A33B	rp   N)r.   r  r  r  r  r  r  r  s   @r&   r  r    s     < <r)   r  )r   r   r   )-rR  r/   r   r]   numpy.testingr   r   scipy._lib._utilr   scipy._lib._array_apir   r   r   r	   r
   r   scipy._lib._array_api_no_0dr   r   
scipy._libr   r  scipyr   r   scipy.fft.tests.test_fftlogr   scipy.optimizer   scipy.statsr   r   r   r   scipy.stats._resamplingr   r   r  r  r  r  r  r  r  r  rp   r)   r&   <module>r     s      7 )P P H -   8  L L - - 9VA VA VAt #$r8 r8 %r8j 5x? x? x?v #$U
* U
* %U
*|0* NP:P:B< <r)   