+
    0i*                         ^ RI t^ RIHtHtHtHtHt ^ RIt^ RIH	t
 ^ RIHt ^ RIHt ^ RIHtHtHtHt R tR t ! R	 R
4      tR t]P0                  P3                  R. RO4      R 4       tR# )    N)assert_equalassert_array_equalassert_array_almost_equalassert_approx_equalassert_allclose)raises)stats)xlogy)marginsexpected_freqchi2_contingencyassociationc                     \         P                  ! ^.4      p \        V 4      p\        \	        V4      ^4       V^ ,          p\        V\         P                  ! ^.4      4       \         P                  ! ^..4      p \        V 4      w  r#\         P                  ! ^..4      p\         P                  ! ^..4      p\        W$4       \        W54       \         P                  ! ^4      P                  ^^4      p \        V 4      w  r#\         P                  ! ^.^3..4      p\         P                  ! . RO.4      p\        W$4       \        W54       \         P                  ! ^4      P                  ^^^4      p \        V 4      w  r#p\         P                  ! ^B..^...4      p\         P                  ! ^<.^\.^|...4      p\         P                  ! . RO..4      p\        W$4       \        W54       \        Wg4       R# )   N)      
            )<   B   H   N   )nparrayr   r   lenr   arangereshape)amm0m1	expected0	expected1m2	expected2s           `/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/stats/tests/test_contingency.pytest_marginsr)      s   
!A
AQ	
1Br288QC=)
1#AQZFB1#I1#Ir%r%
		"a#AQZFB2$&I012Ir%r%
		"aA&AJBBB4&C5'*+IB4"u-./I+,-.Ir%r%r%    c                     \        \        ^.4      \        P                  ! R.4      4       \        P                  ! ^^ .^ ^..^ ^.^^ ..^^.^^...4      p \        V 4      p\        V\        P                  ! V 4      4       \        P                  ! . RO. RO.4      p \        V 4      p\        P                  ! . RO. RO.4      p\        W4       R# )r         ?N)r   r      )r-   r-   r-   )      (@r.   g      0@)      2@r/   g      8@)r   r   r   r   	ones_liker   )observedecorrects      r(   test_expected_freqr4   ,   s    }aS)288SE?;xx1a&1a&)QFQF+;q!fq!f=MNOHhAq",,x01xx|45HhAhh9:Ga)r*   c                   f  a  ] tR t^9t o R tR tR tR tR t]	P                  P                  RRR.4      R	 4       t]	P                  P                  R
 4       t]	P                  P                  ]	P                  P                  R]P                   ]P"                  34      R 4       4       tR tRtV tR# )TestChi2Contingencyc                j   \         P                  ! ^^.^^..4      p\        VRR7      w  r#rE\        VR4       \        VR4       \        V^4       \	        W4       \         P                  ! . RO4      p\        VRR7      w  r#rE\        VR4       \        VR4       \        V^ 4       \	        W4       R# )r   F
correctiong        r,   N)r         )r   r   r   r   r   selfobschi2pdofexpecteds   &     r(   test_chi2_contingency_trivial1TestChi2Contingency.test_chi2_contingency_trivial:   s     hhAA'(!1#%!HT3QS!3) hhy!!1#%!HT3QS!3)r*   c                   \         P                  ! . RO. RO. R	O. R
O.. RO. RO. RO. RO..4      p\        V4      w  r#rE\        VR^R7       \        VR^R7       \	        V^4       \         P                  ! ^^.^^..^^.^^...^^.^^..^^.^^....4      p\        V4      w  r#rE\        VR^R7       \        VR^R7       \	        V^4       R# )r   g{GY@)significantg"j,5#=gjt!@gQI?N)r   "      )#         )r       	   )r   r   r   )   /   rK   )rG   r      )rP         )rM   !      )r   r   r   r   r   r<   s   &     r(   test_chi2_contingency_R+TestChi2Contingency.test_chi2_contingency_RM   s   < hh 	 "2#!6D&a8Aya8S"L hhBxBxBxBx BxBxBxBx	 "2#!6D%Q7Av15S"r*   c           	     F   \         P                  ! ^^<.^^Z..4      p\        VRRR7      w  r#rE\        V^\	        WV,          4      P                  4       ,          4       \        VRRR7      w  r#rEV\         P                  ! RR.RR..4      ,           p\        V^\	        WfV,          4      P                  4       ,          4       \         P                  ! . R	O. R
O.4      p\        VRR7      w  r#rE\        V^\	        WV,          4      P                  4       ,          4       R# )   zlog-likelihoodF)lambda_r9   Tg      ?)rY   Ng      )r   r   r   )r   r   r   )r   r   r   r   r
   sum)r=   cgr@   rA   r2   c_corrs   &      r(   test_chi2_contingency_g+TestChi2Contingency.test_chi2_contingency_g   s    HHr2hR)*'3C38:c1U1c]..001'3C379cRXXc{S$K8991U6!8488::;HHlL12'3CDc1U1c]..001r*   c                    \         P                  ! R^
.^^..4      p\        \        \        V4       \         P                  ! ^ ^.^ ^..4      p\        \        \        V4       \         P
                  ! R4      p\        \        \        V4       R# )r   N)r   r   )r   r   assert_raises
ValueErrorr   empty)r=   r>   s   & r(   test_chi2_contingency_bad_args2TestChi2Contingency.test_chi2_contingency_bad_args   ss     hhR1a&)*j"2C8 hhAA'(j"2C8 hhvj"2C8r*   c                ~    \         P                  ! R ^.^^ ..4      p\        V4      ^,          p\        V^RR7       R# )i%  g-q=rtolN)r   r   r   r   )r=   r1   r@   s   &  r(   #test_chi2_contingency_yates_gh138757TestChi2Contingency.test_chi2_contingency_yates_gh13875   s:     88dAYA/0X&q)15)r*   r9   FTc                    \         P                  ! ^^.^^..4      p\        W!R7      p\        VP                  VP
                  VP                  VP                  3V4       R# )r   r8   N)r   r   r   r   	statisticpvaluerA   r   )r=   r9   r>   ress   &&  r(   test_resultTestChi2Contingency.test_result   sL    hhAA'(s:cmmSZZ#:K:KLcRr*   c                f   \         P                  ! ^4      P                  ^^4      p\        VRR7      P                  p\
        P                  ! V4      P                  p\
        P                  ! RR7      p\        VRVR7      p\        VP                  V4       \        VP                  VRR7       R# )	rN   Fr8   iP  )n_resamplesr9   methodgV瞯<rh   N)r   r   r   r   rm   r	   fisher_exactrn   PermutationMethodr   r   )r=   tableref_statistic
ref_pvalueru   ro   s   &     r(   test_exact_permutation*TestChi2Contingency.test_exact_permutation   s    		!$$Q*(5AKK''.55
((U;uvFS]]M2

JU;r*   ru   c                   \         P                  P                  R 4      p. R	Op. R
Op\        P                  ! W4VR7      P                  4       p\        VRV! VR7      R7      p\        VRR7      p\        VP                  VP                  4       \        VP                  VP                  RR7       \        VP                  \         P                  4       \        VP                  VP                  4       R# )l   {5 )seedF)rngrt   r8   g{Gzt?)atolN)i,  i     )   i  r   i  )r   randomdefault_rngr	   random_tablervsr   r   rm   r   rn   rA   nanr   )r=   ru   r   rowscolsrx   ro   refs   &&      r(   test_resampling_randomized.TestChi2Contingency.test_resampling_randomized   s     ii##J/#""4C8<<>uv#Ou7S]]CMM2

CJJT:SWWbff%S&&(9(9:r*   c           	        \         P                  ! ^4      P                  ^^^4      p\        P                  ! 4       pRp\
        P                  ! \        VR7      ;_uu_ 4        \        VRVR7       RRR4       \         P                  ! ^4      P                  ^^4      p\        P                  ! 4       pRp\
        P                  ! \        VR7      ;_uu_ 4        \        WR7       RRR4       \        P                  ! 4       pRp\
        P                  ! \        VR7      ;_uu_ 4        \        VR^VR	7       RRR4       R
pRp\
        P                  ! \        VR7      ;_uu_ 4        \        VRVR7       RRR4       \        P                  ! \        P                  P                  R7      pRp\
        P                  ! \        VR7      ;_uu_ 4        \        VRVR7       RRR4       R#   + '       g   i     EL; i  + '       g   i     EL%; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)r   z7Use of `method` is only compatible with two-way tables.)matchFrt   Nz+`correction=True` is not compatible with...)ru   z%`lambda_=2` is not compatible with...)r9   rY   ru   herringz;`method='herring'` not recognized; if provided, `method`...)r   z4If the `method` argument of `chi2_contingency` is...)r   r   r   r	   rw   pytestr   rc   r   MonteCarloMethodnormr   )r=   rx   ru   messages   &   r(   test_resampling_invalid_args0TestChi2Contingency.test_resampling_invalid_args   s   		!$$Q1-((*K]]:W55UuVD 6 		!$$Q*((*?]]:W55U2 6 '')9]]:W55UuaO 6 O]]:W55UuVD 6 ''EJJNN;H]]:W55UuVD 65- 655 655
 65
 65
 655s<   #G0H+H+H+H>0H	H	H(	+H;	>I	 N)__name__
__module____qualname____firstlineno__rC   rU   r^   re   rj   r   markparametrizerp   slowr{   r	   rw   r   r   r   __static_attributes____classdictcell__)__classdict__s   @r(   r6   r6   9   s     *&\|29 * [[\E4=9S :S
 [[< < [[[[X(?(?(-(>(>(@ A;A ;E Er*   r6   c            	         \        \        \        ^^.^^..R4       \        \        \        ^^..^^...R4       \        \        \        R^
.^^..R4       \        \        \        \        P                  ! ^^.R^..\
        R7      R4       R# )r   Xcramerdd)dtypeNra   )rb   rc   r   r   r   objectr   r*   r(   test_bad_association_argsr     s    *kQFQF+;SA*kaVH1vh+?J*kRHq!f+=xH*k((QFT1I.f=xIr*   zstat, expectedc                 r    \         P                  ! . RO. RO. RO.4      p\        W R7      p\        W14       R# )r   )r1   ru   N)r   rQ   r   rX   r   )   r   rP   rR   rK   )rM   rX   r   r   rK   )r   r   r   r   )statrB   obs1r    s   &&  r(   
test_assocr     s4     88))(* +D 	T/AA r*   ))r   g?)	tschuprowg:ǰ`ڳ?)pearsong!2q܍?)numpyr   numpy.testingr   r   r   r   r   r   r   rb   scipyr	   scipy.specialr
   scipy.stats.contingencyr   r   r   r   r)   r4   r6   r   r   r   r   r   r*   r(   <module>r      sv    , ,  *  D D&>
*TE TEn	I )<=!	=!r*   