
    !g                     L   d Z ddlZddlmZmZ ddlmZ ddlm	Z	m
Z
  G d d      Z G d d	      Z G d
 dee      Z G d dee      Z G d dee      Zedk(  rK e       Zej%                          ej'                          ej(                    e       Zej%                          yy)zL
Created on Fri Nov 04 10:51:39 2011

Author: Josef Perktold
License: BSD-3
    N)assert_almost_equalassert_equal)	smoothers)OLSWLSc                       e Zd Zd Zd Zd Zy)CheckSmootherc                 $   t        | j                  j                  | j                        | j                  j
                  d       t        | j                  j                  | j                  d d       | j                  j
                  d d d       y )N   decimal
   )r   res_pspredictxres2fittedvaluesselfs    s/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/statsmodels/sandbox/nonparametric/tests/test_smoothers.pytest_predictzCheckSmoother.test_predict   si    DKK//7 II22B	@DKK//s< II223B7	E    c                     t        | j                  j                  j                         | j                  j
                  d       y )N   r   )r   r   coefravelr   paramsr   s    r   	test_coefzCheckSmoother.test_coef   s.    DKK,,224 II,,b	:r   c                 `   t        | j                  j                         | j                  j                  dz          t        | j                  j	                         | j                  j                  dz          t        | j                  j                         | j                  j
                         y )N   )r   r   df_modelr   df_fitdf_residr   s    r   test_dfzCheckSmoother.test_df   so    T[[))+TYY-?-?-ABT[['')499+=+=a+?@T[[))+TYY-?-?@r   N)__name__
__module____qualname__r   r   r$    r   r   r	   r	      s    E:
Ar   r	   c                       e Zd Zed        Zy)BasePolySmootherc                 `   d}d}d}d\  }}t        j                  |||      x| _        }|d d d f   t        j                  |dz         z  x| _        }|j                  d      }t         j                  j                  d       ||t         j                  j                  |      z  z   x| _	        }	y )N   g      ?d   )   r    i )
nplinspacer   arangeexogsumrandomseedrandny)
clsordersigma_noisenobslbubr   r3   y_truer8   s
             r   setup_classzBasePolySmoother.setup_class&   s     BKKB--AdF)RYYuQw%7774!
		v[299??4+@@@@r   N)r%   r&   r'   classmethodr@   r(   r   r   r*   r*   $   s    
A 
Ar   r*   c                   (     e Zd Ze fd       Z xZS )TestPolySmoother1c                    t         |           | j                  | j                  | j                  }}}t        j                  d|      }|j                  |       || _        t        ||d d d df         j                         | _
        y )Nr/   r,   )superr@   r8   r   r3   r   PolySmootherfitr   r   r   r9   r8   r   r3   pmod	__class__s        r   r@   zTestPolySmoother1.setup_class6   sp    UUCEE388d1 %%a+
q$q#v,'++-r   r%   r&   r'   rA   r@   __classcell__rJ   s   @r   rC   rC   4   s    
. 
.r   rC   c                   (     e Zd Ze fd       Z xZS )TestPolySmoother2c                    t         |           | j                  | j                  | j                  }}}t        j                  d|      }|j                  |       || _        t        ||d d d df         j                         | _        y )Nr,      )rE   r@   r8   r   r3   r   rF   smoothr   r   rG   r   rH   s        r   r@   zTestPolySmoother2.setup_classE   sp    UUCEE388d1 %%a+A
q$q#v,'++-r   rK   rM   s   @r   rO   rO   C   s    . .r   rO   c                   (     e Zd Ze fd       Z xZS )TestPolySmoother3c                    t         |           | j                  | j                  | j                  }}}|j
                  d   }t        j                  |      }d|d |dz   d|| dz  d  t        j                  d|      }|j                  ||       || _        t        ||d d d df   |      j                         | _        y )Nr   g?r,   r/      )weights)rE   r@   r8   r   r3   shaper0   onesr   rF   rG   r   r   r   )r9   r8   r   r3   r<   rW   rI   rJ   s          r   r@   zTestPolySmoother3.setup_classU   s    UUCEE388d1wwqz''$-qq	 %%a+G$
q$q#v,8<<>r   rK   rM   s   @r   rT   rT   S   s    ? ?r   rT   __main__)__doc__numpyr0   numpy.testingr   r   !statsmodels.sandbox.nonparametricr   #statsmodels.regression.linear_modelr   r   r	   r*   rC   rO   rT   r%   t1r   r   r$   t3r(   r   r   <module>rb      s     ; 7 8A A*A A .(- ..(- . ?(- ?( z		BOOLLNJJ		BOO r   