State Space Models

All state space models are written and estimated in the R programming language. The models are available here with instructions and R procedures for manipulating the models here here.

Friday, November 9, 2012

Using Forecasting Models

In an earlier post (here) I explained how to use the WL20 model and the ws (world system) package. In this post, I will explain how to use forecasting models such as the one used to make my Peak Oil forecast (here).

Assuming that you have followed my earlier post, have R installed on your machine and have also installed the dse and the matlab packages successfully, the forecasting models are all available here. For this demonstration, download the PeakOilIndexModel to your working directory. Then you can enter the following commands at the prompt in the R console:


> W <- "the complete path name for your working directory"
> setwd(W)
> source(file="LibraryLoad.R)

> load(file="WL20v3_model")
> load(file="ws_procedures")
> load(file="PeakOilIndexModel")

The available forecasting models can be seen by typing (a help file for all the ws package functions is available here):


> summary(OIL.model)

The resulting listing will show each of the available models. For example,


[1] "BAU"
Eigenvalues of system matrix
[1] 0.9836614
[1] TRUE
     Parameter     Mean Mean LCI Mean UCI P>=T[1] P< T[1]
[1,]  240.1784 288.4285 264.6985 309.5271       1       0
     Std. Dev.      Bias    Bias-z
[1,]  18.21428 -48.25009 -2.649025
attr(,"class")
[1] "boot"

[1] "STRUCTURAL"
NULL


The BAU (Business As Usual) entry shows a number of statistics used to evaluate the model. The Structural model displays NULL because no structural model was estimated.

The first statistic displayed for the BAU model is the eigenvalue of the system matrix. If all the eigenvalues are less than unity, the model is stable, which is displayed next as [1] TRUE. The next line shows the bootstrap distribution of the AIC statistic. The first value, 240.1784, is the sample AIC statistic. The second value is the bootstrap mean AIC statistic. The third and fourth values are the lower and upper 98% confidence intervals for the AIC statistic. The remaining values display probabilities, standard deviation and bias for the sample AIC statistic. If you want to inspect the BAU model, enter:


> getModel(OIL.model,type="bau")

Given the AIC statistics, the BAU model is the best one observed. For the forecast, however, I used the  best attractor model which you can display with


> getModel(OIL.model,type="best attractor")

The best attractor model is based on a free-simulation of each estimated model and is chosen using the AIC statistic from the free simulations vs. the actual data residuals. In this case, the world index model


> getModel(OIL.model,type="world index")

provides the best attractor simulation. You can get a flavor for the differences in the predictions from the two models by entering:


> tfplot(sim(getModel(OIL.model,type="bau")))
> tfplot(sim(getModel(OIL.model,type="world index"),sampleT=95,input=WL20.fx))

The BAU model predicts a gradual decline over time in the rate of oil production while the best attractor model shows a sharp peak-and-collapse between 2000 and 2020. 

Why should we be willing to choose one of these models over the other? One is best by conventional standards (step-ahead predictions using the AIC). Another is best by standards derived from attractor theory and application of the AIC criteria to the free simulations of each model. 

In future posts, I'll work through this issue and also reveal some more of the things you can do with the forecasting models using the dse and the ws packages. At this point, you should be able to at least load and inspect the models.

No comments:

Post a Comment