
    M/Ph                     \    d dl Zd dlmZ d dlmZ d dlmZmZ d dlm	Z	  G d d          Z
dS )    N)assert_raises)StepFunctionmonotone_fn_inverter)ECDFDiscretec                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TestDistributionsc                     t          j        d          }t          j        d          }t          ||          } |t          j        ddgddgddgg                    }t	          j        |dd	gd
dgddgg           d S )N   皙	@      @         @      @         r      nparanger   arraynptassert_almost_equalselfxyfvalss        i/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/statsmodels/distributions/tests/test_ecdf.pytest_StepFunctionz#TestDistributions.test_StepFunction
   s    IbMMIbMMAqC:DzC:>??@@1vAwA&?@@@@@    c                    t          j        d          }t          j        d          }t          t          t          ||           t          j        d          }t          j        d          }t          t          t          ||           d S )Nr
      )r   r   )r   r   r   
ValueErrorr   zeros)r   r   r   s      r!   test_StepFunctionBadShapez+TestDistributions.test_StepFunctionBadShape   sh    IbMMIbMMj,1555HVHVj,155555r#   c                    t          j        d          }t          j        d          }t          ||d          } |t          j        ddgddgdd	gg                    }t	          j        |d
dgddgd
dgg           d S )Nr
   rightsider   r   r   r   r   r   r   r   r   r   r   r   s        r!   test_StepFunctionValueSideRightz1TestDistributions.test_StepFunctionValueSideRight   s    IbMMIbMMAG,,,qC:DzC:>??@@1vAwA&?@@@@@r#   c                     g d}g d}t          ||          }t          j         |g d          g d           t          ||d          }t          j         |g d          g d           d S )N)
   r/   r   r   r   r   r   r   r      
         	   
                  )r/   r   r   r   r0   )r   r3   r6   r9   r:   r*   r+   )r3   r6   r9   r:   r;   )r   r   r   )r   r   r   r   f2s        r!   test_StepFunctionRepeatedValuesz1TestDistributions.test_StepFunctionRepeatedValues    s    ***000A/// 2 24F4F4FGGG!QW---??? 3 35H5H5HIIIIIr#   c                     g d}d } |t          j        |                    }t          ||          }t          j        |j        |d d d                    t          j        |j        |d d d                    d S )Nr1   c                     d| z  S )Ng      ? )r   s    r!   <lambda>z=TestDistributions.test_monotone_fn_inverter.<locals>.<lambda>*   s
    1 r#   )r   r   r   r   assert_array_equalr   r   )r   r   fnr   r   s        r!   test_monotone_fn_inverterz+TestDistributions.test_monotone_fn_inverter(   s|    000_Brx{{OO Q''qsAdddG,,,qsAdddG,,,,,r#   c                 ~   g d}t          |          }t          j        |j        t          j         dddg           t          j        |j        g d           t          g d          }t          g dg d	          }t          j        |j        |j                   t          j        |j        |j                   d S )
N)r   r   r/   r   r/   r   r   )r   g      ?g      ?r/   )      @rG         ?r/   r   )rG   rH   r/   r   )r   r/   r/   r/   )freq_weights)r   r   rC   r   r   infr   )r   r   ee1e2s        r!   test_ecdf_discretez$TestDistributions.test_ecdf_discrete0   s    LLOOqsbfWaA$6777qs$6$6$6777///00***FFFrtRT***rtRT*****r#   N)	__name__
__module____qualname__r"   r(   r-   r=   rE   rN   r@   r#   r!   r   r      sw        A A A6 6 6A A AJ J J- - -+ + + + +r#   r   )numpyr   numpy.testingtestingr   r   statsmodels.distributionsr   r   r   r   r@   r#   r!   <module>rV      s              ' ' ' ' ' ' H H H H H H H H 2 2 2 2 2 20+ 0+ 0+ 0+ 0+ 0+ 0+ 0+ 0+ 0+r#   