kwargs.setdefault('marker', 'o')
        kwargs.setdefault('linestyle', 'None')
        a, = self.plot(lags, c, **kwargs)
        b = None
    return lags, c, a, b






arrvs = ar_generator()
##arma = ARIMA()
##res = arma.fit(arrvs[0], 4, 0)
arma = ARIMA(arrvs[0])
res = arma.fit((4,0, 0))

print(res[0])

acf1 = acf(arrvs[0])
acovf1b = acovf(arrvs[0], unbiased=False)
acf2 = autocorr(arrvs[0])
acf2m = autocorr(arrvs[0]-arrvs[0].mean())
print(acf1[:10])
print(acovf1b[:10])
print(acf2[:10])
print(acf2m[:10])


x = arma_generate_sample([1.0, -0.8], [1.0], 500)
print(acf(x)[:20])
Exemple #2
0
        kwargs.setdefault('linestyle', 'None')
        d = self.plot(lags, c, **kwargs)
    else:

        kwargs.setdefault('marker', 'o')
        kwargs.setdefault('linestyle', 'None')
        a, = self.plot(lags, c, **kwargs)
        b = None
    return lags, c, a, b


arrvs = ar_generator()
##arma = ARIMA()
##res = arma.fit(arrvs[0], 4, 0)
arma = ARIMA(arrvs[0])
res = arma.fit((4, 0, 0))

print(res[0])

acf1 = acf(arrvs[0])
acovf1b = acovf(arrvs[0], unbiased=False)
acf2 = autocorr(arrvs[0])
acf2m = autocorr(arrvs[0] - arrvs[0].mean())
print(acf1[:10])
print(acovf1b[:10])
print(acf2[:10])
print(acf2m[:10])

x = arma_generate_sample([1.0, -0.8], [1.0], 500)
print(acf(x)[:20])
import statsmodels.api as sm
Exemple #3
0
                         np.minimum(np.abs(start_params_mle[:-1]), 0.75))

print 'conditional least-squares'

#print rhohat2
print 'with mle'
arest2.nar = 2
arest2.nma = 2
#
res = arest2.fit_mle(start_params=start_params_mle,
                     method='nm')  #no order in fit
print res.params
rhohat2, cov_x2a, infodict, mesg, ier = arest2.fit((2, 2))
print '\nARIMA_old'
arest = ARIMA_old(y22)
rhohat1, cov_x1, infodict, mesg, ier = arest.fit((2, 0, 2))
print rhohat1
print np.sqrt(np.diag(cov_x1))
err1 = arest.errfn(x=y22)
print np.var(err1)
print 'bse ls, formula  not checked'
print np.sqrt(np.diag(cov_x1)) * err1.std()
print 'bsejac for mle'
#print arest2.bsejac
#TODO:check bsejac raises singular matrix linalg error
#in model.py line620: return np.linalg.inv(np.dot(jacv.T, jacv))

print '\nyule-walker'
print sm.regression.yule_walker(y22, order=2, inv=True)

print '\nArmamle_old'
Exemple #4
0
                         * np.minimum(np.abs(start_params_mle[:-1]),0.75))


print('conditional least-squares')

#print rhohat2
print('with mle')
arest2.nar = 2
arest2.nma = 2
#
res = arest2.fit_mle(start_params=start_params_mle, method='nm') #no order in fit
print(res.params)
rhohat2, cov_x2a, infodict, mesg, ier = arest2.fit((2,2))
print('\nARIMA_old')
arest = ARIMA_old(y22)
rhohat1, cov_x1, infodict, mesg, ier = arest.fit((2,0,2))
print(rhohat1)
print(np.sqrt(np.diag(cov_x1)))
err1 = arest.errfn(x=y22)
print(np.var(err1))
print('bse ls, formula  not checked')
print(np.sqrt(np.diag(cov_x1))*err1.std())
print('bsejac for mle')
#print arest2.bsejac
#TODO:check bsejac raises singular matrix linalg error
#in model.py line620: return np.linalg.inv(np.dot(jacv.T, jacv))

print('\nyule-walker')
print(sm.regression.yule_walker(y22, order=2, inv=True))

print('\nArmamle_old')