-----Original Message----- From: scipy-user-bounces@scipy.org [mailto:scipy-user-bounces@scipy.org] On Behalf Of josef.pktd@gmail.com Sent: Friday, March 12, 2010 9:53 AM To: SciPy Users List Subject: Re: [SciPy-User] OT: advice on modelling a time series 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.
I don't know about rpy (classic), but in rpy2, you can input any R expression as a string. import rpy2.robjects as ro R = ro.r [code that defines x and y in python] # set the variables up in the R environment R.globalEnv['xR'] = x # needs to be a list? R.globalEnv['yR'] = y Fit = R("some pure R expression using xR and yR") Probably won't be all that fast, but it'll work. -paul h.