예제 #1
0
def acf_pacf_plot(series, lags=50, figsize=(10, 10)):
    fig, axes = plt.subplots(nrows=2, ncols=1, figsize=figsize)

    plotting.plot_acf(series, lags, ax=axes[0])
    axes[0].set_title('Autocorrelation (ACF)')

    plotting.plot_acf(series, lags, ax=axes[1], partial=True)
    axes[1].set_title('Partial autocorrelation (PACF)')
예제 #2
0
파일: ts_pres.py 프로젝트: wesm/statlib
def acf_pacf_plot(series, lags=50, figsize=(10,10)):
    fig, axes = plt.subplots(nrows=2, ncols=1, figsize=figsize)

    plotting.plot_acf(series, lags, ax=axes[0])
    axes[0].set_title('Autocorrelation (ACF)')

    plotting.plot_acf(series, lags, ax=axes[1], partial=True)
    axes[1].set_title('Partial autocorrelation (PACF)')
예제 #3
0
파일: pw_ch07.py 프로젝트: wesm/statlib
    return out

def simulate_76(pi=0.9, phi=0.9, v=1, T=5000):
    rv = np.sqrt(v)

    s = v / (1 - phi**2)
    root_s = np.sqrt(s)

    x = 1
    out = np.empty(T)
    for t in xrange(T):
        flip = np.random.binomial(1, pi)
        if flip:
            out[t] = x = phi * x + randn() * rv
        else:
            out[t] = x = randn() * root_s

    return out

if __name__ == '__main__':
    sim = simulate_76(pi=1, T=10000)
    print acf(sim, nlags=10)
    plotting.plot_acf(sim)

    plt.show()

    yenusd = np.loadtxt('statlib/data/japan-usa1000.txt', delimiter=',')
    ukusd = np.loadtxt('statlib/data/uk-usa1000.txt', delimiter=',')

예제 #4
0
    return out


def simulate_76(pi=0.9, phi=0.9, v=1, T=5000):
    rv = np.sqrt(v)

    s = v / (1 - phi**2)
    root_s = np.sqrt(s)

    x = 1
    out = np.empty(T)
    for t in xrange(T):
        flip = np.random.binomial(1, pi)
        if flip:
            out[t] = x = phi * x + randn() * rv
        else:
            out[t] = x = randn() * root_s

    return out


if __name__ == '__main__':
    sim = simulate_76(pi=1, T=10000)
    print acf(sim, nlags=10)
    plotting.plot_acf(sim)

    plt.show()

    yenusd = np.loadtxt('statlib/data/japan-usa1000.txt', delimiter=',')
    ukusd = np.loadtxt('statlib/data/uk-usa1000.txt', delimiter=',')
예제 #5
0
파일: arma.py 프로젝트: linuxster/statlib
 def plot_acf(self, lags=50, partial=True):
     plotting.plot_acf(self.data, lags, partial=partial)
예제 #6
0
파일: arma.py 프로젝트: wesm/statlib
 def plot_acf(self, lags=50, partial=True):
     plotting.plot_acf(self.data, lags, partial=partial)