def estimate(self, nbcorr=np.nan, numpsd=-1):
fft_length, _ = self.check_params()
if np.isnan((nbcorr)):
nbcorr = self.ordar
# -------- estimate correlation from psd
full_psd = self.psd[numpsd]
full_psd = np.c_[full_psd, np.conjugate(full_psd[:, :0:-1])]
correl = fftpack.ifft(full_psd[0], fft_length, 0).real
# -------- estimate AR part
col1 = correl[self.ordma:self.ordma + nbcorr]
row1 = correl[np.abs(
np.arange(self.ordma, self.ordma - self.ordar, -1))]
R = linalg.toeplitz(col1, row1)
r = -correl[self.ordma + 1:self.ordma + nbcorr + 1]
AR = linalg.solve(R, r)
self.AR_ = AR
# -------- estimate correlation of MA part
# -------- estimate MA part
if self.ordma == 0:
sigma2 = correl[0] + np.dot(AR, correl[1:self.ordar + 1])
self.MA = np.ones(1) * np.sqrt(sigma2)
else:
raise NotImplementedError(
'arma: estimation of the MA part not yet implemented')
评论列表
文章目录