Sunday, May 06, 2007

I Shouldn't Be Surprised, But I Am a Little.

Basically, this year I learned statistics. And everything I learned was very abstract. In my classes, I was never once called upon to analyze an actual dataset. I did a little on my own as part of my effort to do all the homework for a simpler econometrics course, but it was all kind of canned and not very exciting.

But yesterday I got tired of studying book stuff, and wanted to do something a little more fun but still relevant, so I thought I would check for unit roots and structural breaks in weather data. (I just found out that you can get monthly temperature data for England going back to 1659! It's free at http://hadobs.metoffice.com/hadcet/data/download.html.) I wrote a program in gauss to do these things, and because I don't trust myself so much, I thought I would do some Monte Carlo trials to see if my statistics were being calculated correctly.

And the thing that shouldn't be surprising, but kind of is, is that these techniques really work! For example, I generated five hundred data according to this model:

y_{t+1}=2 + a*y_{t} + e

where e is a normally distributed random error term with mean zero and variance 0.25. I then set a=1 (that is, there is a unit root), and calculated the appropriate Dickey-Fuller test statistic. This rejects the presence of a unit root at 90% if the critical value is less than -2.57. In thirty trials, it came up with these statistics:

-0.43573590
-3.5956646 *
0.16992838
0.073596016
-2.6977168 *
1.8725950
-1.1551782
1.4518842
-0.72521093
0.88719054
0.19026298
0.74761789
-0.87596782
0.55484388
0.55116807
3.8321580
1.1601078
-2.1123924
-3.9787004 *
0.22736827
-1.3979254
2.0005073
-1.5957790
-2.6886918 *
-1.9549079
2.9131591
-0.76821185
0.76051801
-1.0562308
-0.27190441

Sure enough, it rejected incorrectly four times out of thirty, which is close enough to 10% for random data. Now, observe what happens if I change a to 0.999 -- that is, awfully close to one, but not quite a unit root. Here's what comes out:

-19.039612
-19.276780
-25.051717
-20.740252
-23.782902
-24.197974
-19.147238
-22.555892
-19.436182
-23.419553
-20.569042
-23.110684
-24.328111
-21.205045
-24.545090
-20.042392
-20.988465
-22.970617
-22.802407
-22.611619
-19.959404
-24.710798
-19.793600
-25.165184
-22.078757
-20.559708
-23.508961
-25.047222
-19.818685
-24.183677

100% rejection! This is a mighty powerful test. My structural break F-statistics are also impressive. It makes me have a little more faith that all this theory is really worth something after all.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home