danilobellini / audiolazy

Expressive Digital Signal Processing (DSP) package for Python
GNU General Public License v3.0
689 stars 74 forks source link

[Question] AR prediction with ZFilter FIR #9

Open Uiuran opened 4 years ago

Uiuran commented 4 years ago

Iam trying to understand how the ZFilter object does its operation in the fitted time series (with Levinson Durbin AutoCorrelation coefficients) when you put the time series in the object caller in order to do Auto Regression, ie, x[t] = a[t-1]x[t-1]+a[t-2]x[t-2]+...+a[t-order]*x[t-order]

so i call:


Order=...
zf=levinson_durbin(acorr(timeseries[N-Order-1:N-1]),order=Order) # here iam fitting the 'a' coefficients according to the last Order elements of timeseries

fitted=zf(timeseries[N-Order-1:N-1]).take(Order)) # what exactly the FIR filter is doing here ? when 
 i call take to get Order elements based on the timeseries window of size Order ? 

Seems that the first element of the fitting by FIR, when i call take, is almost exactly the the same of the original series, while the others are not.

I would like to know what the FIR is doing depending upon the argment of .take, and why i cannot take more then Order elements, since i would like to do the AutoRegressive prevision, then use it to do another prevision with the same fitted FIR (like in the AR formula given above).

Thank you for your time and patience.