U
    md                     @   s   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 dZG dd	 d	ZG d
d deeZG dd deeZG dd deeZedkre Ze  e  ej e Ze  dS )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                   @   s$   e Zd Zdd Zdd Zdd ZdS )CheckSmootherc                 C   sL   t | j| j| jjdd t | j| jd d | jjd d dd d S )N   decimal
   )r   res_psZpredictxres2Zfittedvaluesself r   o/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/statsmodels/sandbox/nonparametric/tests/test_smoothers.pytest_predict   s      zCheckSmoother.test_predictc                 C   s   t | jj | jjdd d S )N   r	   )r   r   ZcoefZravelr   paramsr   r   r   r   	test_coef   s     zCheckSmoother.test_coefc                 C   sH   t | j | jjd  t | j | jjd  t | j | jj d S )N   )r   r   Zdf_modelr   Zdf_fitZdf_residr   r   r   r   test_df   s    zCheckSmoother.test_dfN)__name__
__module____qualname__r   r   r   r   r   r   r   r      s   r   c                   @   s   e Zd Zedd ZdS )BasePolySmootherc           
      C   s   d}d}d}d\}}t ||| | _}|d d d f t |d   | _}|d}t jd ||t j|   | _	}	d S )N   g      ?d   )   r   i )
npZlinspacer   ZarangeexogsumrandomseedZrandny)
clsorderZsigma_noisenobsZlbZubr   r"   Zy_truer&   r   r   r   setup_class'   s    $
zBasePolySmoother.setup_classN)r   r   r   classmethodr*   r   r   r   r   r   %   s   r   c                       s    e Zd Ze fddZ  ZS )TestPolySmoother1c                    sd   t t|   | j| j| j  }}}td|}|| || _	t
||d d d df  | _d S )Nr    r   )superr,   r*   r&   r   r"   r   PolySmootherfitr   r   r   r'   r&   r   r"   pmod	__class__r   r   r*   7   s    
zTestPolySmoother1.setup_classr   r   r   r+   r*   __classcell__r   r   r2   r   r,   5   s   r,   c                       s    e Zd Ze fddZ  ZS )TestPolySmoother2c                    sd   t t|   | j| j| j  }}}td|}|| || _	t
||d d d df  | _d S )Nr      )r-   r6   r*   r&   r   r"   r   r.   Zsmoothr   r   r/   r   r0   r2   r   r   r*   F   s    
zTestPolySmoother2.setup_classr4   r   r   r2   r   r6   D   s   r6   c                       s    e Zd Ze fddZ  ZS )TestPolySmoother3c                    s   t t|   | j| j| j  }}}|jd }t|}d|d |d < d|| d d < t	
d|}|j||d || _t||d d d df |d | _d S )Nr   g?r   r       )weights)r-   r8   r*   r&   r   r"   shaper!   Zonesr   r.   r/   r   r   r   )r'   r&   r   r"   r)   r:   r1   r2   r   r   r*   V   s    

zTestPolySmoother3.setup_classr4   r   r   r2   r   r8   T   s   r8   __main__)__doc__numpyr!   Znumpy.testingr   r   Z!statsmodels.sandbox.nonparametricr   Z#statsmodels.regression.linear_modelr   r   r   r   r,   r6   r8   r   t1r   r   r   t3r   r   r   r   <module>   s    