コード例 #1
0
class TestBiweight(CheckNormalReferenceConstant):

    kern = kernels.Biweight()
    constant = 2.78
コード例 #2
0
ファイル: test_kernels.py プロジェクト: lema655/statsmodels
class TestBiweight(CheckKernelMixin):
    kern_name = 'bi'
    kern = kernels.Biweight()
    se_n_diff = 9
    low_rtol = 0.3
コード例 #3
0
ファイル: try_smoothers.py プロジェクト: zhisheng/statsmodels
"""
import numpy as np

if __name__ == "__main__":
    #from statsmodels.sandbox.nonparametric import smoothers as s
    from statsmodels.sandbox.nonparametric import smoothers, kernels
    import matplotlib.pyplot as plt
    #from numpy import sin, array, random

    import time
    np.random.seed(500)
    x = np.random.normal(size=250)
    y = np.array(
        [np.sin(i * 5) / i + 2 * i + (3 + i) * np.random.normal() for i in x])

    K = kernels.Biweight(0.25)
    K2 = kernels.CustomKernel(lambda x: (1 - x * x)**2,
                              0.25,
                              domain=[-1.0, 1.0])

    KS = smoothers.KernelSmoother(x, y, K)
    KS2 = smoothers.KernelSmoother(x, y, K2)

    KSx = np.arange(-3, 3, 0.1)
    start = time.time()
    KSy = KS.conf(KSx)
    KVar = KS.std(KSx)
    print time.time() - start  # This should be significantly quicker...
    start = time.time()  #
    KS2y = KS2.conf(KSx)  #
    K2Var = KS2.std(KSx)  #