Exemple #1
0
def test_plotacf():
    # Just test that it runs.
    fig = plt.figure()
    ax = fig.add_subplot(111)

    ar = np.r_[1., -0.9]
    ma = np.r_[1.,  0.9]
    armaprocess = tsp.ArmaProcess(ar, ma)
    acf = armaprocess.acf(20)[:20]
    plotacf(acf, ax=ax)

    plt.close(fig)
def test_plotacf():
    # Just test that it runs.
    fig = plt.figure()
    ax = fig.add_subplot(111)

    ar = np.r_[1.0, -0.9]
    ma = np.r_[1.0, 0.9]
    armaprocess = tsp.ArmaProcess(ar, ma)
    acf = armaprocess.acf(20)[:20]
    plotacf(acf, ax=ax)

    plt.close(fig)
fig.suptitle('ARMA: Autocorrelation (left) and Partial Autocorrelation (right)')
subplotcount = 1
nrows = 4
for arcoef in arcoefs[:-1]:
    for macoef in macoefs[:-1]:
        ar = np.r_[1., -arcoef]
        ma = np.r_[1.,  macoef]

        #y = tsp.arma_generate_sample(ar,ma,nsample, sig, burnin)
        #armaprocess = FftArmaProcess(ar, ma, nsample) #TODO: make n optional
        #armaprocess.plot4()
        armaprocess = tsp.ArmaProcess(ar, ma)
        acf = armaprocess.acf(20)[:20]
        pacf = armaprocess.pacf(20)[:20]
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(ax, acf)
##        ax.set_title('Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
##                     size='xx-small')
        ax.text(0.7, 0.6, 'ar =%s \nma=%s' % (ar, ma),
                transform=ax.transAxes,
                horizontalalignment='left', #'right',
                size='xx-small')
        ax.set_xlim(-1,20)
        subplotcount +=1
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(ax, pacf)
##        ax.set_title('Partial Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
##                     size='xx-small')
        ax.text(0.7, 0.6, 'ar =%s \nma=%s' % (ar, ma),
                transform=ax.transAxes,
                horizontalalignment='left', #'right',
Exemple #4
0
    'ARMA: Autocorrelation (left) and Partial Autocorrelation (right)')
subplotcount = 1
nrows = 4
for arcoef in arcoefs[:-1]:
    for macoef in macoefs[:-1]:
        ar = np.r_[1., -arcoef]
        ma = np.r_[1., macoef]

        #y = tsp.arma_generate_sample(ar,ma,nsample, sig, burnin)
        #armaprocess = FftArmaProcess(ar, ma, nsample) #TODO: make n optional
        #armaprocess.plot4()
        armaprocess = tsp.ArmaProcess(ar, ma)
        acf = armaprocess.acf(20)[:20]
        pacf = armaprocess.pacf(20)[:20]
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(ax, acf)
        ##        ax.set_title('Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
        ##                     size='xx-small')
        ax.text(
            0.7,
            0.6,
            'ar =%s \nma=%s' % (ar, ma),
            transform=ax.transAxes,
            horizontalalignment='left',  #'right',
            size='xx-small')
        ax.set_xlim(-1, 20)
        subplotcount += 1
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(ax, pacf)
        ##        ax.set_title('Partial Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
        ##                     size='xx-small')
Exemple #5
0
    'ARMA: Autocorrelation (left) and Partial Autocorrelation (right)')
subplotcount = 1
nrows = 4
for arcoef in arcoefs[:-1]:
    for macoef in macoefs[:-1]:
        ar = np.r_[1., -arcoef]
        ma = np.r_[1., macoef]

        #y = tsp.arma_generate_sample(ar,ma,nsample, sig, burnin)
        #armaprocess = FftArmaProcess(ar, ma, nsample) #TODO: make n optional
        #armaprocess.plot4()
        armaprocess = tsp.ArmaProcess(ar, ma)
        acf = armaprocess.acf(20)[:20]
        pacf = armaprocess.pacf(20)[:20]
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(acf, ax=ax)
        ##        ax.set_title('Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
        ##                     size='xx-small')
        ax.text(
            0.7,
            0.6,
            'ar =%s \nma=%s' % (ar, ma),
            transform=ax.transAxes,
            horizontalalignment='left',  #'right',
            size='xx-small')
        ax.set_xlim(-1, 20)
        subplotcount += 1
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(pacf, ax=ax)
        ##        ax.set_title('Partial Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
        ##                     size='xx-small')
Exemple #6
0
fig.suptitle('ARMA: Autocorrelation (left) and Partial Autocorrelation (right)')
subplotcount = 1
nrows = 4
for arcoef in arcoefs[:-1]:
    for macoef in macoefs[:-1]:
        ar = np.r_[1., -arcoef]
        ma = np.r_[1.,  macoef]

        #y = tsp.arma_generate_sample(ar,ma,nsample, sig, burnin)
        #armaprocess = FftArmaProcess(ar, ma, nsample) #TODO: make n optional
        #armaprocess.plot4()
        armaprocess = tsp.ArmaProcess(ar, ma)
        acf = armaprocess.acf(20)[:20]
        pacf = armaprocess.pacf(20)[:20]
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(acf, ax=ax)
##        ax.set_title('Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
##                     size='xx-small')
        ax.text(0.7, 0.6, 'ar =%s \nma=%s' % (ar, ma),
                transform=ax.transAxes,
                horizontalalignment='left', #'right',
                size='xx-small')
        ax.set_xlim(-1,20)
        subplotcount +=1
        ax = fig.add_subplot(nrows, 2, subplotcount)
        plotacf(pacf, ax=ax)
##        ax.set_title('Partial Autocorrelation \nar=%s, ma=%rs' % (ar, ma),
##                     size='xx-small')
        ax.text(0.7, 0.6, 'ar =%s \nma=%s' % (ar, ma),
                transform=ax.transAxes,
                horizontalalignment='left', #'right',