def arma_acovf(ar, ma, nobs=10):
 if (np.abs((np.sum(ar) - 1)) > 0.9):
  nobs_ir = max(1000, (2 * nobs))
 else:
  nobs_ir = max(100, (2 * nobs))
 ir = arma_impulse_response(ar, ma, nobs=nobs_ir)
 while (ir[(-1)] > (5 * 1e-05)):
  nobs_ir *= 10
  ir = arma_impulse_response(ar, ma, nobs=nobs_ir)
 if ((nobs_ir > 50000) and (nobs < 1001)):
  acovf = np.array([np.dot(ir[:(nobs - t)], ir[t:nobs]) for t in range(nobs)])
 else:
  acovf = np.correlate(ir, ir, 'full')[(len(ir) - 1):]
 return acovf[:nobs]

def arma_acovf ( ar , ma , nobs = 10 ) : if ( np . abs ( ( np . sum ( ar ) - 1 ) ) > 0.9 ) : nobs_ir = max ( 1000 , ( 2 * nobs ) ) else : nobs_ir = max ( 100 , ( 2 * nobs ) ) ir = arma_impulse_response ( ar , ma , nobs = nobs_ir ) while ( ir [ ( - 1 ) ] > ( 5 * 1e-05 ) ) : nobs_ir *= 10 ir = arma_impulse_response ( ar , ma , nobs = nobs_ir ) if ( ( nobs_ir > 50000 ) and ( nobs < 1001 ) ) : acovf = np . array ( [ np . dot ( ir [ : ( nobs - t ) ] , ir [ t : nobs ] ) for t in range ( nobs ) ] ) else : acovf = np . correlate ( ir , ir , 'full' ) [ ( len ( ir ) - 1 ) : ] return acovf [ : nobs ]
theoretical autocovariance function of arma process parameters ar : array_like .