[Numpy-discussion] simulate AR

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Oct 14 14:29:46 EDT 2011


On Fri, Oct 14, 2011 at 2:18 PM, Alan G Isaac <alan.isaac at gmail.com> wrote:
> On 10/14/2011 1:42 PM, josef.pktd at gmail.com wrote:
>> If I remember correctly, signal.lfilter doesn't require stationarity,
>> but handling of the starting values is a bit difficult.
>
>
> Hmm.  Yes.
> AR(1) is trivial, but how do you handle higher orders?

I would have to look for it.
You can invert the stationary part of the AR polynomial with the numpy
polynomial classes using division. The main thing is to pad with
enough zeros corresponding to the truncation that you want. And in the
old classes to watch out because the order is reversed high to low
instead of low to high or the other way around.

I switched to using mostly lfilter, but I guess the statsmodels
sandbox (and the mailing list) still has my "playing with ARMA
polynomials" code.
(I think it might be pretty useful for teaching. I wished I had the
functions to calculate some examples when I learned this.)

Josef
>
> Thanks,
> Alan
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list