[Numpy-discussion] simulate AR

josef.pktd@gmai... josef.pktd@gmai...
Fri Oct 14 13:29:46 CDT 2011

On Fri, Oct 14, 2011 at 2:18 PM, Alan G Isaac <alan.isaac@gmail.com> wrote:
> On 10/14/2011 1:42 PM, josef.pktd@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.)

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

More information about the NumPy-Discussion mailing list