Ë
    £�DjÊj  ã                   ó–  — d Z ddlZddlmZmZ dZd6d„Zd6d„Zd„ Z	dj                  e¬	«      e	_         d
„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d„ Zd„ Zd„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d„ Zdj                  e¬	«      e_         d „ Zd!„ Zd"j                  e¬	«      e_         d#„ Zd$j                  e¬	«      e_         d%„ Zd&„ Zd'j                  e¬	«      e_         d(„ Zd)j                  e¬	«      e_         d*„ Zd+j                  e¬	«      e_         d,„ Zd-j                  e¬	«      e_         d.„ Zd/j                  e¬	«      e_         d0„ Z d1„ Z!d2j                  e¬	«      e!_         d3„ Z"d4j                  e¬	«      e"_         eeeeeeeeee"d5œ
Z#e	eeeeeeeee!d5œ
Z$y)7uD  Asymmetric kernels for R+ and unit interval

References
----------

.. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
   Asymmetric Kernel Density Estimators and Smoothed Histograms with
   Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

.. [2] Chen, Song Xi. 1999. â€œBeta Kernel Estimators for Density Functions.â€�
   Computational Statistics & Data Analysis 31 (2): 131â€“45.
   https://doi.org/10.1016/S0167-9473(99)00010-9.

.. [3] Chen, Song Xi. 2000. â€œProbability Density Function Estimation Using
   Gamma Kernels.â€�
   Annals of the Institute of Statistical Mathematics 52 (3): 471â€“80.
   https://doi.org/10.1023/A:1004165218295.

.. [4] Jin, Xiaodong, and Janusz Kawczak. 2003. â€œBirnbaum-Saunders and
   Lognormal Kernel Estimators for Modelling Durations in High Frequency
   Financial Data.â€� Annals of Economics and Finance 4: 103â€“24.

.. [5] Micheaux, Pierre Lafaye de, and FrÃ©dÃ©ric Ouimet. 2020. â€œA Study of Seven
   Asymmetric Kernels for the Estimation of Cumulative Distribution Functions,â€�
   November. https://arxiv.org/abs/2011.14893v1.

.. [6] Mombeni, Habib Allah, B Masouri, and Mohammad Reza Akhoond. 2019.
   â€œAsymmetric Kernels for Boundary Modification in Distribution Function
   Estimation.â€� REVSTAT, 1â€“27.

.. [7] Scaillet, O. 2004. â€œDensity Estimation Using Inverse and Reciprocal
   Inverse Gaussian Kernels.â€�
   Journal of Nonparametric Statistics 16 (1â€“2): 217â€“26.
   https://doi.org/10.1080/10485250310001624819.


Created on Mon Mar  8 11:12:24 2021

Author: Josef Perktold
License: BSD-3

é    N)ÚspecialÚstatsa[  Parameters
    ----------
    x : array_like, float
        Points for which density is evaluated. ``x`` can be scalar or 1-dim.
    sample : ndarray, 1-d
        Sample from which kde is computed.
    bw : float
        Bandwidth parameter, there is currently no default value for it.

    Returns
    -------
    Components for kernel estimationc           
      ój  — t        |«      r|}n	t        |   }|dz  }t        j                  | «      t	        |«      z  |k  rZt        j                  | «      dkD  rt        j
                  | «      dd…df   }  || ||«      }|€|j                  d«      }|S ||z  }|S |€*t        j                  t	        |«      «      t	        |«      z  }|t	        |«      z  }	t	        | «      |	z  }
t        j                  | |
«      }t        j                  |D �cg c]  } ||dd…df   ||«      |z  ‘Œ c}«      }|S c c}w )ac  Density estimate based on asymmetric kernel.

    Parameters
    ----------
    x : array_like, float
        Points for which density is evaluated. ``x`` can be scalar or 1-dim.
    sample : ndarray, 1-d
        Sample from which kernel estimate is computed.
    bw : float
        Bandwidth parameter, there is currently no default value for it.
    kernel_type : str or callable
        Kernel name or kernel function.
        Currently supported kernel names are "beta", "beta2", "gamma",
        "gamma2", "bs", "invgamma", "invgauss", "lognorm", "recipinvgauss" and
        "weibull".
    weights : None or ndarray
        If weights is not None, then kernel for sample points are weighted
        by it. No weights corresponds to uniform weighting of each component
        with 1 / nobs, where nobs is the size of `sample`.
    batch_size : float
        If x is an 1-dim array, then points can be evaluated in vectorized
        form. To limit the amount of memory, a loop can work in batches.
        The number of batches is determined so that the intermediate array
        sizes are limited by

        ``np.size(batch) * len(sample) < batch_size * 1000``.

        Default is to have at most 10000 elements in intermediate arrays.

    Returns
    -------
    pdf : float or ndarray
        Estimate of pdf at points x. ``pdf`` has the same size or shape as x.
    éè  é   Néÿÿÿÿ)
ÚcallableÚkernel_dict_pdfÚnpÚsizeÚlenÚasarrayÚmeanÚonesÚarray_splitÚconcatenate)ÚxÚsampleÚbwÚkernel_typeÚweightsÚ
batch_sizeÚkfuncÚpdfiÚpdfÚkÚnÚx_splitÚxis                úpC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\statsmodels/nonparametric/kernels_asymmetric.pyÚpdf_kernel_asymr!   >   ó0  € ôH �ÔØ‰ä Ñ,ˆà˜dÑ"€Jä	‡w�wˆqƒz”C˜“KÑ *Ò,ä�7‰7�1‹:˜Š>Ü—
‘
˜1“ša ˜gÑ&ˆAá�Q˜ Ó#ˆØˆ?Ø—)‘)˜B“-ˆCð €Jð ˜‘.ˆCð €Jð ˆ?Ü—g‘gœc &›kÓ*¬S°«[Ñ8ˆGàœ#˜f›+Ñ%ˆÜ�‹F�a‰KˆÜ—.‘.  AÓ&ˆÜ�n‰nØ(/ö1Ø"$ñ  % Rª¨4¨¡[°&¸"Ó=ÀÓGò 1ó 2ˆð €Jùò1ó   ÄD0c           
      ój  — t        |«      r|}n	t        |   }|dz  }t        j                  | «      t	        |«      z  |k  rZt        j                  | «      dkD  rt        j
                  | «      dd…df   }  || ||«      }|€|j                  d«      }|S ||z  }|S |€*t        j                  t	        |«      «      t	        |«      z  }|t	        |«      z  }	t	        | «      |	z  }
t        j                  | |
«      }t        j                  |D �cg c]  } ||dd…df   ||«      |z  ‘Œ c}«      }|S c c}w )av  Estimate of cumulative distribution based on asymmetric kernel.

    Parameters
    ----------
    x : array_like, float
        Points for which density is evaluated. ``x`` can be scalar or 1-dim.
    sample : ndarray, 1-d
        Sample from which kernel estimate is computed.
    bw : float
        Bandwidth parameter, there is currently no default value for it.
    kernel_type : str or callable
        Kernel name or kernel function.
        Currently supported kernel names are "beta", "beta2", "gamma",
        "gamma2", "bs", "invgamma", "invgauss", "lognorm", "recipinvgauss" and
        "weibull".
    weights : None or ndarray
        If weights is not None, then kernel for sample points are weighted
        by it. No weights corresponds to uniform weighting of each component
        with 1 / nobs, where nobs is the size of `sample`.
    batch_size : float
        If x is an 1-dim array, then points can be evaluated in vectorized
        form. To limit the amount of memory, a loop can work in batches.
        The number of batches is determined so that the intermediate array
        sizes are limited by

        ``np.size(batch) * len(sample) < batch_size * 1000``.

        Default is to have at most 10000 elements in intermediate arrays.

    Returns
    -------
    cdf : float or ndarray
        Estimate of cdf at points x. ``cdf`` has the same size or shape as x.
    r   r   Nr   )
r	   Úkernel_dict_cdfr   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   ÚcdfiÚcdfr   r   r   r   s                r    Úcdf_kernel_asymr(   �   r"   r#   c                 ób   — t         j                  j                  || |z  dz   d| z
  |z  dz   «      S ©Nr   )r   Úbetar   ©r   r   r   s      r    Úkernel_pdf_betar-   Ä   s.   € ä�:‰:�>‰>˜& ! b¡&¨1¡*¨q°1©u¸©l¸QÑ.>Ó?Ð?ó    u      Beta kernel for density, pdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 1999. â€œBeta Kernel Estimators for Density Functions.â€�
       Computational Statistics & Data Analysis 31 (2): 131â€“45.
       https://doi.org/10.1016/S0167-9473(99)00010-9.
    )Ú
doc_paramsc                 ób   — t         j                  j                  || |z  dz   d| z
  |z  dz   «      S r*   )r   r+   Úsfr,   s      r    Úkernel_cdf_betar2   Ú   s.   € ä�:‰:�=‰=˜  R¡¨!¡¨a°!©e°r©\¸AÑ-=Ó>Ð>r.   u#      Beta kernel for cumulative distribution, cdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 1999. â€œBeta Kernel Estimators for Density Functions.â€�
       Computational Statistics & Data Analysis 31 (2): 131â€“45.
       https://doi.org/10.1016/S0167-9473(99)00010-9.
    c                 ób  — d|dz  z  dz   }d|dz  z  d|dz  z  z   dz   }t        j                  | «      dk(  rÛ| d|z  k  rM|t        j                  || dz  z
  | |z  z
  «      z
  }t        j                  j                  ||d| z
  |z  «      }|S | dd|z  z
  kD  rOd| z
  }|t        j                  ||dz  z
  ||z  z
  «      z
  }t        j                  j                  || |z  |«      }|S t        j                  j                  || |z  d| z
  |z  «      }|S | |z  }d| z
  |z  }	| d|z  k  }
| |
   }|t        j                  ||dz  z
  ||z  z
  «      z
  ||
<   | dd|z  z
  kD  }d| |   z
  }|t        j                  ||dz  z
  ||z  z
  «      z
  |	|<   t        j                  j                  |||	«      }|S ©Né   g      @é   é   g      @r   )r   r   Úsqrtr   r+   r   ©r   r   r   Úa1Úa2Úar   Úx_Úalphar+   Úmask_lowÚmask_upps               r    Úkernel_pdf_beta2rA   ð   sÚ  € ð 
ˆR�‰U‰�S‰€BØ	
ˆR�‰U‰�Q˜˜Q™‘YÑ	 Ñ	%€Bä	‡w�wˆqƒz�Q‚àˆq�2‰vŠ:Ø”R—W‘W˜R ! Q¡$™Y¨¨R©Ñ/Ó0Ñ0ˆAÜ—*‘*—.‘. ¨¨Q°©U°b©LÓ9ˆCð* €Jð) �!�a˜"‘f‘*ÒØ�Q‘ˆBØ”R—W‘W˜R " a¡%™Z¨"¨r©'Ñ1Ó2Ñ2ˆAÜ—*‘*—.‘. ¨¨R©°Ó3ˆCð" €Jô —*‘*—.‘. ¨¨R©°!°a±%¸2±Ó>ˆCð €Jð �B‘ˆØ�A‘˜‰|ˆà�q˜2‘v‘:ˆØˆx‰[ˆØœrŸw™w r¨B°©E¡z°B¸±GÑ';Ó<Ñ<ˆˆh‰à˜˜A ™F™
Ñ#ˆØ��8‘‰_ˆØœbŸg™g b¨2¨q©5¡j°2¸±7Ñ&:Ó;Ñ;ˆˆX‰ä�j‰j�n‰n˜V U¨DÓ1ˆà€Jr.   u-      Beta kernel for density, pdf, estimation with boundary corrections.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 1999. â€œBeta Kernel Estimators for Density Functions.â€�
       Computational Statistics & Data Analysis 31 (2): 131â€“45.
       https://doi.org/10.1016/S0167-9473(99)00010-9.
    c                 ób  — d|dz  z  dz   }d|dz  z  d|dz  z  z   dz   }t        j                  | «      dk(  rÛ| d|z  k  rM|t        j                  || dz  z
  | |z  z
  «      z
  }t        j                  j                  ||d| z
  |z  «      }|S | dd|z  z
  kD  rOd| z
  }|t        j                  ||dz  z
  ||z  z
  «      z
  }t        j                  j                  || |z  |«      }|S t        j                  j                  || |z  d| z
  |z  «      }|S | |z  }d| z
  |z  }	| d|z  k  }
| |
   }|t        j                  ||dz  z
  ||z  z
  «      z
  ||
<   | dd|z  z
  kD  }d| |   z
  }|t        j                  ||dz  z
  ||z  z
  «      z
  |	|<   t        j                  j                  |||	«      }|S r4   )r   r   r8   r   r+   r1   r9   s               r    Úkernel_cdf_beta2rC   &  sÚ  € ð 
ˆR�‰U‰�S‰€BØ	
ˆR�‰U‰�Q˜˜Q™‘YÑ	 Ñ	%€Bä	‡w�wˆqƒz�Q‚àˆq�2‰vŠ:Ø”R—W‘W˜R ! Q¡$™Y¨¨R©Ñ/Ó0Ñ0ˆAÜ—*‘*—-‘- ¨¨A°©E°R©<Ó8ˆCð* €Jð) �!�a˜"‘f‘*ÒØ�Q‘ˆBØ”R—W‘W˜R " a¡%™Z¨"¨r©'Ñ1Ó2Ñ2ˆAÜ—*‘*—-‘- ¨¨B©°Ó2ˆCð" €Jô —*‘*—-‘- ¨¨B©°°Q±¸"±Ó=ˆCð €Jð �B‘ˆØ�A‘˜‰|ˆØ�q˜2‘v‘:ˆàˆx‰[ˆØœrŸw™w r¨B°©E¡z°B¸±GÑ';Ó<Ñ<ˆˆh‰à˜˜A ™F™
Ñ#ˆØ��8‘‰_ˆØœbŸg™g b¨2¨q©5¡j°2¸±7Ñ&:Ó;Ñ;ˆˆX‰ä�j‰j�m‰m˜F E¨4Ó0ˆà€Jr.   u"      Beta kernel for cdf estimation with boundary correction.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 1999. â€œBeta Kernel Estimators for Density Functions.â€�
       Computational Statistics & Data Analysis 31 (2): 131â€“45.
       https://doi.org/10.1016/S0167-9473(99)00010-9.
    c                 óV   — t         j                  j                  || |z  dz   |¬«      }|S ©Nr   ©Úscale©r   Úgammar   )r   r   r   r   s       r    Úkernel_pdf_gammarJ   \  s'   € ä�;‰;�?‰?˜6 1 r¡6¨A¡:°Rˆ?Ó8€DØ€Kr.   u-      Gamma kernel for density, pdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 2000. â€œProbability Density Function Estimation Using
       Gamma Krnels.â€�
       Annals of the Institute of Statistical Mathematics 52 (3): 471â€“80.
       https://doi.org/10.1023/A:1004165218295.
    c                 óV   — t         j                  j                  || |z  dz   |¬«      }|S rE   ©r   rI   r1   )r   r   r   r&   s       r    Úkernel_cdf_gammarM   t  s)   € ô �;‰;�>‰>˜& ! b¡&¨1¡*°Bˆ>Ó7€DØ€Kr.   u=      Gamma kernel for cumulative distribution, cdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 2000. â€œProbability Density Function Estimation Using
       Gamma Krnels.â€�
       Annals of the Institute of Statistical Mathematics 52 (3): 471â€“80.
       https://doi.org/10.1023/A:1004165218295.
    c                 óL   — t         j                  j                  || |z  |¬«      S )zÅGamma kernel for pdf, without boundary corrected part.

    drops `+ 1` in shape parameter

    It should be possible to use this if probability in
    neighborhood of zero boundary is small.

    rF   rH   r,   s      r    Ú_kernel_pdf_gammarO   �  s!   € ô �;‰;�?‰?˜6 1 r¡6°ˆ?Ó4Ð4r.   c                 óL   — t         j                  j                  || |z  |¬«      S )zÅGamma kernel for cdf, without boundary corrected part.

    drops `+ 1` in shape parameter

    It should be possible to use this if probability in
    neighborhood of zero boundary is small.

    rF   rL   r,   s      r    Ú_kernel_cdf_gammarQ   ™  s!   € ô �;‰;�>‰>˜& ! b¡&°ˆ>Ó3Ð3r.   c                 óä   — t        j                  | «      dk(  r| d|z  k  r| |z  dz  dz   }n!| |z  }n| |z  }| d|z  k  }||   dz  dz   ||<   t        j                  j	                  |||¬«      }|S ©Nr   r5   rF   )r   r   r   rI   r   ©r   r   r   r<   Úmaskr   s         r    Úkernel_pdf_gamma2rV   ¥  s~   € ä	‡w�wˆqƒz�Q‚àˆq�2‰vŠ:Ø�R‘˜!‘˜a‘‰Aà�B‘‰Aà�‰FˆØ�1�r‘6‰zˆØ�D‘'˜1‘*˜q‘.ˆˆ$‰Ü
�+‰+�/‰/˜& !¨2ˆ/Ó
.€Cà€Jr.   uF      Gamma kernel for density, pdf, estimation with boundary correction.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 2000. â€œProbability Density Function Estimation Using
       Gamma Krnels.â€�
       Annals of the Institute of Statistical Mathematics 52 (3): 471â€“80.
       https://doi.org/10.1023/A:1004165218295.
    c                 óä   — t        j                  | «      dk(  r| d|z  k  r| |z  dz  dz   }n!| |z  }n| |z  }| d|z  k  }||   dz  dz   ||<   t        j                  j	                  |||¬«      }|S rS   )r   r   r   rI   r1   rT   s         r    Úkernel_cdf_gamma2rX   È  s~   € ä	‡w�wˆqƒz�Q‚àˆq�2‰vŠ:Ø�R‘˜!‘˜a‘‰Aà�B‘‰Aà�‰FˆØ�1�r‘6‰zˆØ�D‘'˜1‘*˜q‘.ˆˆ$‰Ü
�+‰+�.‰.˜ ¨"ˆ.Ó
-€Cà€Jr.   u<      Gamma kernel for cdf estimation with boundary correction.

    {doc_params}

    References
    ----------
    .. [1] Bouezmarni, Taoufik, and Olivier Scaillet. 2005. â€œConsistency of
       Asymmetric Kernel Density Estimators and Smoothed Histograms with
       Application to Income Data.â€� Econometric Theory 21 (2): 390â€“412.

    .. [2] Chen, Song Xi. 2000. â€œProbability Density Function Estimation Using
       Gamma Krnels.â€�
       Annals of the Institute of Statistical Mathematics 52 (3): 471â€“80.
       https://doi.org/10.1023/A:1004165218295.
    c                 óX   — t         j                  j                  |d|z  dz   | |z  ¬«      S rE   )r   Úinvgammar   r,   s      r    Úkernel_pdf_invgammar[   ë  s*   € ä�>‰>×Ñ˜f a¨"¡f¨q¡j¸¸B¹ÐÓ?Ð?r.   u†      Inverse gamma kernel for density, pdf, estimation.

    Based on cdf kernel by Micheaux and Ouimet (2020)

    {doc_params}

    References
    ----------
    .. [1] Micheaux, Pierre Lafaye de, and FrÃ©dÃ©ric Ouimet. 2020. â€œA Study of
       Seven Asymmetric Kernels for the Estimation of Cumulative Distribution
       Functions,â€� November. https://arxiv.org/abs/2011.14893v1.
    c                 óX   — t         j                  j                  |d|z  dz   | |z  ¬«      S rE   )r   rZ   r1   r,   s      r    Úkernel_cdf_invgammar]   ÿ  s*   € ä�>‰>×Ñ˜V Q¨¡V¨a¡Z°q¸2±vÐÓ>Ð>r.   u_      Inverse gamma kernel for cumulative distribution, cdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Micheaux, Pierre Lafaye de, and FrÃ©dÃ©ric Ouimet. 2020. â€œA Study of
       Seven Asymmetric Kernels for the Estimation of Cumulative Distribution
       Functions,â€� November. https://arxiv.org/abs/2011.14893v1.
    c                 óZ   — | }d|z  }t         j                  j                  |||z  |¬«      S rE   )r   Úinvgaussr   ©r   r   r   ÚmÚlams        r    Úkernel_pdf_invgaussrc     s0   € à	€AØ
ˆb‰&€CÜ�>‰>×Ñ˜f a¨#¡g°SÐÓ9Ð9r.   uZ      Inverse gaussian kernel for density, pdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Scaillet, O. 2004. â€œDensity Estimation Using Inverse and Reciprocal
       Inverse Gaussian Kernels.â€�
       Journal of Nonparametric Statistics 16 (1â€“2): 217â€“26.
       https://doi.org/10.1080/10485250310001624819.
    c                 óä   — dt        j                  dt         j                  z  |z  |dz  z  «      z  t        j                  dd|z  | z  z  || z  dz
  | |z  z   z  «      z  }|j	                  d«      S )zJInverse gaussian kernel density, explicit formula.

    Scaillet 2004
    r   r5   é   r   )r   r8   ÚpiÚexpr   ©r   r   r   r   s       r    Úkernel_pdf_invgauss_ri   &  so   € ð
 Œr�w‰w�qœ2Ÿ5™5‘y 2‘~¨°©	Ñ1Ó2Ñ2Ü�6‰6�#˜˜R™ !™Ñ$¨°©
°Q©¸¸V¹Ñ(CÑDÓEñF€Cà�8‰8�B‹<Ðr.   c                 óZ   — | }d|z  }t         j                  j                  |||z  |¬«      S rE   )r   r_   r1   r`   s        r    Úkernel_cdf_invgaussrk   0  s0   € à	€AØ
ˆb‰&€CÜ�>‰>×Ñ˜V Q¨¡W°CÐÓ8Ð8r.   uj      Inverse gaussian kernel for cumulative distribution, cdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Scaillet, O. 2004. â€œDensity Estimation Using Inverse and Reciprocal
       Inverse Gaussian Kernels.â€�
       Journal of Nonparametric Statistics 16 (1â€“2): 217â€“26.
       https://doi.org/10.1080/10485250310001624819.
    c                 ól   — d| |z
  z  }d|z  }t         j                  j                  |||z  d|z  ¬«      S rE   )r   Úrecipinvgaussr   r`   s        r    Úkernel_pdf_recipinvgaussrn   E  s@   € ð
 	
ˆQ�‰V‰€AØ
ˆb‰&€CÜ×Ñ×"Ñ" 6¨1¨s©7¸!¸c¹'Ð"ÓBÐBr.   ue      Reciprocal inverse gaussian kernel for density, pdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Scaillet, O. 2004. â€œDensity Estimation Using Inverse and Reciprocal
       Inverse Gaussian Kernels.â€�
       Journal of Nonparametric Statistics 16 (1â€“2): 217â€“26.
       https://doi.org/10.1080/10485250310001624819.
    c                 óÎ   — dt        j                  dt         j                  z  |z  |z  «      z  t        j                  | |z
   d|z  z  |z  | |z
  z  dz
  | |z
  |z  z   «      z  }|S )zUReciprocal inverse gaussian kernel density, explicit formula.

    Scaillet 2004
    r   r5   )r   r8   rf   rg   rh   s       r    Úkernel_pdf_recipinvgauss_rp   ]  su   € ð Œr�w‰w�qœ2Ÿ5™5‘y 2‘~¨Ñ.Ó/Ñ/Ü�6‰6�Q˜‘V�*  B¡Ñ'¨&Ñ0°A¸±FÑ;¸aÑ?Ø�r‘6˜VÑ#ñ$ó %ñ%€Cð €Jr.   c                 ól   — d| |z
  z  }d|z  }t         j                  j                  |||z  d|z  ¬«      S rE   )r   rm   r1   r`   s        r    Úkernel_cdf_recipinvgaussrr   i  s@   € ð
 	
ˆQ�‰V‰€AØ
ˆb‰&€CÜ×Ñ×!Ñ! &¨!¨c©'¸¸S¹Ð!ÓAÐAr.   u[      Reciprocal inverse gaussian kernel for cdf estimation.

    {doc_params}

    References
    ----------
    .. [1] Scaillet, O. 2004. â€œDensity Estimation Using Inverse and Reciprocal
       Inverse Gaussian Kernels.â€�
       Journal of Nonparametric Statistics 16 (1â€“2): 217â€“26.
       https://doi.org/10.1080/10485250310001624819.
    c                 óF   — t         j                  j                  ||| ¬«      S ©NrF   )r   Úfatiguelifer   r,   s      r    Úkernel_pdf_bsrv   �  s    € ä×Ñ× Ñ  ¨°1Ð Ó5Ð5r.   uZ      Birnbaum Saunders (normal) kernel for density, pdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Jin, Xiaodong, and Janusz Kawczak. 2003. â€œBirnbaum-Saunders and
       Lognormal Kernel Estimators for Modelling Durations in High Frequency
       Financial Data.â€� Annals of Economics and Finance 4: 103â€“24.
    c                 óF   — t         j                  j                  ||| ¬«      S rt   )r   ru   r1   r,   s      r    Úkernel_cdf_bsrx   “  s    € ä×Ñ×Ñ ¨°!ÐÓ4Ð4r.   u      Birnbaum Saunders (normal) kernel for cdf estimation.

    {doc_params}

    References
    ----------
    .. [1] Jin, Xiaodong, and Janusz Kawczak. 2003. â€œBirnbaum-Saunders and
       Lognormal Kernel Estimators for Modelling Durations in High Frequency
       Financial Data.â€� Annals of Economics and Finance 4: 103â€“24.
    .. [2] Mombeni, Habib Allah, B Masouri, and Mohammad Reza Akhoond. 2019.
       â€œAsymmetric Kernels for Boundary Modification in Distribution Function
       Estimation.â€� REVSTAT, 1â€“27.
    c                 ó¢   — t        j                  dt        j                  d|z   «      z  «      }t        j                  j                  ||| ¬«      S ©Nr6   r   rF   )r   r8   Úlogr   Úlognormr   ©r   r   r   Úbw_s       r    Úkernel_pdf_lognormr   ¨  s>   € ô �'‰'�!”B—F‘F˜1˜R™4“L‘.Ó
!€CÜ�=‰=×Ñ˜V S°ÐÓ2Ð2r.   u¡      Log-normal kernel for density, pdf, estimation.

    {doc_params}

    Notes
    -----
    Warning: parameterization of bandwidth will likely be changed

    References
    ----------
    .. [1] Jin, Xiaodong, and Janusz Kawczak. 2003. â€œBirnbaum-Saunders and
       Lognormal Kernel Estimators for Modelling Durations in High Frequency
       Financial Data.â€� Annals of Economics and Finance 4: 103â€“24.
    c                 ó¢   — t        j                  dt        j                  d|z   «      z  «      }t        j                  j                  ||| ¬«      S rz   )r   r8   r{   r   r|   r1   r}   s       r    Úkernel_cdf_lognormr�   Æ  s>   € ô �'‰'�!”B—F‘F˜1˜R™4“L‘.Ó
!€CÜ�=‰=×Ñ˜F C¨qÐÓ1Ð1r.   u±      Log-normal kernel for cumulative distribution, cdf, estimation.

    {doc_params}

    Notes
    -----
    Warning: parameterization of bandwidth will likely be changed

    References
    ----------
    .. [1] Jin, Xiaodong, and Janusz Kawczak. 2003. â€œBirnbaum-Saunders and
       Lognormal Kernel Estimators for Modelling Durations in High Frequency
       Financial Data.â€� Annals of Economics and Finance 4: 103â€“24.
    c                 ó>  — dt        j                  d|z   «      z  }dt        j                  |t         j                  z  «      z  |z  t        j                  t        j                  | «      t        j                  |«      z
  dz   |z  «      z  }|j                  d«      S )z]Log-normal kernel for density, pdf, estimation, explicit formula.

    Jin, Kawczak 2003
    é   r   r5   r   )r   r{   r8   rf   rg   r   )r   r   r   Útermr   s        r    Úkernel_pdf_lognorm_r…   ä  s{   € ð
 Œr�v‰v�a˜"‘f‹~Ñ€DØŒr�w‰w�tœbŸe™e‘|Ó$Ñ$ vÑ-Ü�6‰6”R—V‘V˜A“Y¤§¡¨£Ñ/°!Ñ3Ð3°dÑ:Ó;ñ<€Cà�8‰8�B‹<Ðr.   c           	      ó~   — t         j                  j                  |d|z  | t        j                  d|z   «      z  ¬«      S rE   )r   Úweibull_minr   r   rI   r,   s      r    Úkernel_pdf_weibullrˆ   ï  sA   € ô
 ×Ñ× Ñ  ¨¨R©Ø'(¬7¯=©=¸¸R¹Ó+@Ñ'@ð !ó Bð Br.   u\      Weibull kernel for density, pdf, estimation.

    Based on cdf kernel by Mombeni et al. (2019)

    {doc_params}

    References
    ----------
    .. [1] Mombeni, Habib Allah, B Masouri, and Mohammad Reza Akhoond. 2019.
       â€œAsymmetric Kernels for Boundary Modification in Distribution Function
       Estimation.â€� REVSTAT, 1â€“27.
    c           	      ó~   — t         j                  j                  |d|z  | t        j                  d|z   «      z  ¬«      S rE   )r   r‡   r1   r   rI   r,   s      r    Úkernel_cdf_weibullrŠ     sA   € ô
 ×Ñ×Ñ ¨¨B©Ø&'¬'¯-©-¸¸B¹Ó*?Ñ&?ð  ó Að Ar.   u:      Weibull kernel for cumulative distribution, cdf, estimation.

    {doc_params}

    References
    ----------
    .. [1] Mombeni, Habib Allah, B Masouri, and Mohammad Reza Akhoond. 2019.
       â€œAsymmetric Kernels for Boundary Modification in Distribution Function
       Estimation.â€� REVSTAT, 1â€“27.
    )
r+   Úbeta2ÚbsrI   Úgamma2rZ   r_   r|   rm   Úweibull)Né
   )%Ú__doc__Únumpyr   Úscipyr   r   r/   r!   r(   r-   Úformatr2   rA   rC   rJ   rM   rO   rQ   rV   rX   r[   r]   rc   ri   rk   rn   rp   rr   rv   rx   r   r�   r…   rˆ   rŠ   r%   r
   © r.   r    ú<module>r•      s  ðñ)óV ß  ð(€
ó@óF@òF@ð
÷ 	‰˜*ˆÓ%ð Ô ò"?ð
÷ 	‰˜*ˆÓ%ð Ô ò""ðJ÷ 	‰˜*ˆÓ%ð Ô ò""ðJ÷ 	‰˜*ˆÓ%ð Ô ò"ð÷ 	‰˜*ˆÓ%ð Ô ò$ð÷ 	‰˜*ˆÓ%ð Ô ò$	5ò	4òð"÷ 	‰˜*ˆÓ%ð Ô ò$ð"÷ 	‰˜*ˆÓ%ð Ô ò$@ð
÷ 	‰˜*ˆÓ%ð Ô ò?ð

÷ 	‰˜*ˆÓ%ð Ô ò:ð÷ 	‰˜*ˆÓ%ð Ô òò9ð÷ 	‰˜*ˆÓ%ð Ô òCð$÷ 	‰˜*ˆÓ%ð Ô  ò	òBð$÷ 	‰˜*ˆÓ%ð Ô  ò6ð

÷ 	‰˜*ˆÓ%ð Ô ò5ð
÷ 	‰˜*ˆÓ%ð Ô ò 
3ð÷ 	‰˜*ˆÓ%ð Ô ò"
2ð÷ 	‰˜*ˆÓ%ð Ô ò"òBð÷ 	‰˜*ˆÓ%ð Ô òAð
÷ 	‰˜*ˆÓ%ð Ô ð" ØØ
ØØØ#Ø#Ø!Ø-Ø!ñ€ð ØØ
ØØØ#Ø#Ø!Ø-Ø!ñ�r.   