# [SciPy-User] OT: advice on modelling a time series

josef.pktd@gmai... josef.pktd@gmai...
Fri Mar 12 11:53:12 CST 2010

```On Fri, Mar 12, 2010 at 12:16 PM, Robin <robince@gmail.com> wrote:
> On Fri, Mar 12, 2010 at 5:10 PM,  <josef.pktd@gmail.com> wrote:
>> On Fri, Mar 12, 2010 at 12:01 PM, Robert Kern <robert.kern@gmail.com> wrote:
>>> On Fri, Mar 12, 2010 at 10:46,  <josef.pktd@gmail.com> wrote:
>>>> On Fri, Mar 12, 2010 at 11:32 AM,  <josef.pktd@gmail.com> wrote:
>>>
>>>>> From the graph, it also looks like the three observations are strongly
>>>>> related, so separate (univariate) modeling doesn't look like the most
>>>>> appropriate choice.
>>>>
>>>> from looking at the graphs:
>>>>
>>>> If acceleration is an independent GARCH process, then velocity would
>>>> just be the integral (plus noise), isn't it?
>>>
>>> Robin will have to confirm, but I suspect that only the position was
>>> actually measured and that he derived the velocity and acceleration
>>> from the position time series numerically.
>>
>> In that case it might not be to difficult to go in reverse, from
>> acceleration to position. From the graph, I would think that
>> acceleration is the random input for the process. Maybe with some
>> adjustments to correct for specification errors.
>
> Right - I am primarily working with position - vel and acc are shown
> just to illustrate the features I am hoping to preserve/replicate (ie
> transient high acceleration events which aren't really visible in the
> position trace, even when blown up quite a lot). I did the
> differentiation with basic finite differences (diff), smoothed with a
> 1ms (4bin moving average) (this was the method used by others
> previously).
>
> Arguably acceleration is the most important of the representations
> (this is part of the hypothesis we are planning to test) so I agree
> starting from acceleration and integrating to get the actual position
> to use could be a good idea.
>
> In the mean time I have to look up a lot of the other things you
> mentioned before I have anything sensible to add (heteroscedastic is a
> new one on me and I will look up GARCH and ARCH also) .
>
> Thanks very much for the quick and useful responses!

If you have rpy and R installed, you can try something like this on
your position data, to see whether GARCH is helpful (ret is my 1d
numpy.array with the time series)

from rpy import r
r.library('fGarch')

# pure garch on mean corrected data
f = r.formula('~garch(1, 1)')
fit = r.garchFit(f, data = ret - ret.mean(), include_mean=False)

#ARMA in mean, GARCH in variance
f = r.formula('~arma(1,1) + ~garch(1, 1)')
fit = r.garchFit(f, data = ret)

I haven't figured out how to do many of the options for GARCH with rpy.

Josef

>
> Cheers
>
> Robin
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
```