Skip to content

Speaking of time series

June 20, 2012

This weekend I wrote a simple AR(1) process in Matlab.  For kicks just now I ported it to Python.  Here’s an example of an ipython session in which I created 10 simulations, each with 10,000 observations, using a coefficient of 0.25, mean constant of 8, and standard deviation of 0.4.


In [1]: import ar1

In [2]: beta=0.25

In [3]: c=8

In [4]: sigma=0.4

In [5]: sims=ar1.simulate(10, 10000, beta, c, sigma)

In [6]: for sim in sims:
print str(ar1.fit(sim))
...:
(0.2456241979316662, 8.039670345021344, 0.4005802839081577)
(0.26269173583406669, 7.8658157445985104, 0.40067700748671264)
(0.25080291694490975, 7.9829412941212041, 0.40008786155521492)
(0.23849164273828619, 8.1268425384433005, 0.40244757878872384)
(0.23731989072323761, 8.1306157454693579, 0.39673446453761163)
(0.24088332077603036, 8.0971291647248087, 0.40266273196208063)
(0.24092356282570837, 8.0980025783096252, 0.40075384950504139)
(0.24059702316383563, 8.0928273681935199, 0.39797438141261765)
(0.25950709107966674, 7.8905209140742265, 0.40305518484472025)
(0.26037304559450791, 7.893634672469922, 0.3986525853167327)
Advertisements

From → nuts n bolts

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: