Esempio n. 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)')
Esempio n. 2
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)')
Esempio n. 3
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=',')

Esempio n. 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=',')
Esempio n. 5
0
 def plot_acf(self, lags=50, partial=True):
     plotting.plot_acf(self.data, lags, partial=partial)
Esempio n. 6
0
File: arma.py Progetto: wesm/statlib
 def plot_acf(self, lags=50, partial=True):
     plotting.plot_acf(self.data, lags, partial=partial)