# Online documentation for STAMP

**A quick reference to the unobserved components time series methodology adopted in STAMP can be found here:****STAMP consists of the following dialogs for model formulation and estimation:**- Formulate
- Select components
- Estimate
- Options
- Regression coefficients
- Select interventions
- Edit and fix parameter values
**STAMP consists of the following dialogs for model evaluation:**- Test Menu
- Further Output
- Component graphics
- Weight functions
- Residual graphics
- Auxiliary Residual graphics
- Prediction graphics
- Forecasting
- Store in Database
**STAMP also offers the following facilities:**- Ox code generator
- Batch language

## The STAMP dialogs

### Formulate - STAMP unobserved components module

Use this dialog for single equation dynamic model formulation to formulate a new model, or reformulate an existing model.

**Database**-
Mark all the variables you wish to include in the new model or add to the
existing model, using the Tab or Arrow keys and selecting by spacebar or by left clicking the mouse.
After you have pressed << (or double-clicked if you are using a mouse),
the database variables are added to the model with the default
lag length.
The variable at the top of the list will by default become the endogenous (

**Y**) variable. To select a different dependent variable, see below. **Lags**-
At the top you can choose how the lag length is set with which variables
are added to the model:
*None*: no lags.*Lag*: just using the lag specified below.*Lag 0 to*: from lag 0 to the lag specified below.

**Selection**-
This list box shows the current model.

The variable at the top of the list will by default become the endogenous (Y) variable.

To select a dependent variable which is listed further down:- mark the current dependent variable and right-click to clear its status;
- mark the new variable, and right-click to change to
*Y: endogenous*.

**<<**- Adds the currently selected database or special variables to the model.
**>>**- Deletes the currently selected variables from the model.
**Clear>>**-
Deletes the whole model, so that you can start from scratch.
**Previous models**- Use this to recall a previously estimated model.
**OK**- Press OK to move to the Select components or Estimation.

### Select components - STAMP unobserved components module

This dialog is for choosing the components of the model.

**Basic components**

- Select whether or not you wish to include a Level, Slope, Seasonal (this option is not available for annual data) and Irregular component in the model. For Level, Slope and Seasonal you can choose the component to be Fixed or Stochastic You can select and deselect the options by left clicking the box on the right of the option or you can use the Tab or Arrow keys of your keyboard and select the option by pressing spacebar.
**Cycle(s)**

- You have the option to include up to three cycles in the model. The three cylces have different default frequencies. You can also choose to include Autoregressive components by selecting the AR(1) or AR(2) option.
**Options**

There are three additional options, which can be selected by marking the box on the right of the option. After you have pressed OK in the Select components dialog, for every option you selected a dialog will be shown.- Set regression coefficients
- Select interventions

- Edit and fix parameter values

### Regression coefficients - STAMP unobserved components module

For every explanatory variable you can choose the type of regression coefficient by selecting the variable (using Tab or Arrow keys and pressing spacebar, or by clicking)
and then selecting the type of coefficient from the list that will be shown on the right of the variable, by using Tab or Arrow keys and pressing Enter or by clicking.
Press OK when finished. This will take you to the next option or, if you did not select any other option, to Estimation

### Select interventions - STAMP unobserved components module

When this dialog opens, it will show a list of interventions. By default the list will consist of one irregular intervention.
You can change the type of intervention by clicking *irregular* and selecting a type from the list that will be shown.
You also have the option to include interventions in Level and Slope.

One cell to the right you can select the period in which the intervention takes place. If you wish to include the intervention in the model,
mark the box under Select.

**Add**- Adds a new intervention to the current list. This intervention will be irregular and unselected by deafult. You can modify new interventions in the same way as described above.
**<**- Moves one cell to the left in the list.
**>**- Moves one cell to the left in the list.
**Del**- Deletes the selected intervention from the list.
**Save As...**- Allows you to save the current list of interventions. You can choose to save the list in Matrix, Excel, OxMetrics or Comma seperated form.
**Load...**- Allows you to load a list of interventions saved earlier.
**Clear**- Deletes the whole list, so that you can start from scratch.
**OK**- Press OK to move to the next option or, if you did not select any other option, to Estimation

### Edit and fix parameter values - STAMP unobserved components module

If you wish to fix any of the parameters of the components used in the model, simply mark the box under Fix of the component you wish to fix the parameter for. You can then set the fixed value by selecting the cell under Value which currently contains a default value and then by changing this into the desired value.

**<**- Moves one cell to the left in the list.
**>**- Moves one cell to the left in the list.
**Save As...**- Allows you to save the current values of the parameters. You can choose to save the list in Matrix, Excel, OxMetrics or Comma seperated form.
**Load...**- Allows you to load a list parameter values saved earlier.
**Clear**- Deletes the whole list, so that you can start from scratch.
**OK**- Press OK to move to Estimation

### Estimate - STAMP unobserved components module

Select the sample period and an estimation method.

**Choose the estimation sample**-
Enter the sample period you wish to use for the estimation. The maximum
sample is given one line up.

The default is the whole sample. **Choose the estimation method**- Select the method of estimation you want to use.
**OK**- Pressing OK starts the estimation, unless there still is something missing or wrong in the dialog.

### Options (all)

Controls maximization settings, and what is automatically printed after estimation (in addition to the normal estimation report). Model options referes to settings which are changed infrequently, and are persistent between runs of STAMP.

**Maximization Settings**-
*Maximum number of iterations*:

Note that it is possible that the maximum number of iterations is reached before convergence. The maximum number of iterations also equals the maximum number of switches in cointegration.*Write results every*:

By default no iteration progress is displayed in the results window. It is possible to write intermediate information to the Results window for a more permanent record. A zero (the default) will write nothing, a 1 every iteration, a 2 every other iteration, etc.*Write in compact form*:

Writes one line per printed iteration (see*Write results every*).*Convergence tolerance*:

Change the convergence tolerance levels (the smaller, the longer the estimation will take to converge). See under numerical optimization for an explanation of convergence decisions.*Default*:

Resets the default maximization settings.

### Test Menu

This dialog box gives access to a selection of diagnostic testing procedures. Mark the tests you want to be executed, then press OK.

- More written output
- Components graphics

- Weight functions

- Residuals graphics

- Auxiliary Residual graphics

- Prediction graphics

- Forecasting

- Store in Database

### More written output

### Components graphics

**Plots Y with**- Gives you the option to plot the dependent variable Y togehter with the Trend. The options to plot Y togehter with the Trend and other components are only available if those components are included in the model.
**Select components**- Mark the boxes of the components of which you wish to see a plot. Only components that are included in the model can be selected.
**Select type of plot**- You can choose to make individual plots of the components or to make a plot of the composite signal. The latter can also be plotted together with Y or cross-plotted against Y.
**Further plots**- Gives you the option to plot Detrended Y, Seasonally adjested Y and individual seasonals plots.
**Prediction, filtering and smoothing**- You can choose whether you want to use Predictive filtering, Filtering or Smoothing to estimate the components. Smoothing is set as default. If you wish to use more than one method, you can choose to plot the different estimates together or separately.
**Further options**-
Components estimates can be plotted together with confidence intervals.

Anti-log analysis can be used (this is useful when the data are in logs).

You can choose which part of the sample will be used for the components estimates and which part of the estimates will be plotted.

Default is the whole sample for both options.

The selected components can be stored in the OxMetrics database. OxMetrics will prompt for a variable name.

### Weight functions

### Residuals graphics

**One step ahead prediction residuals (standardized)**- Plots the standardized residuals of the one step ahead predictions.
**Diagnostic plots**- Mark the boxes of the desired plots. You can choose a Correlogram and specify the number of Lags, a Spectrum and specify the range, a Histogram and a QQ-plot.
**Cumulative plots**- Gives you the option to plot the cumulative sum of the residuals, the cumulative sum of squares of the residuals and the cumulative sum scaled so that it can be compared with the critical values of the t-test.
**Write**- Mark the Diagnostics box if you wish to view the Goodness-of-fit based on the residuals and Serial correlation statistics for the residuals. These will be shown in OxMetrics/Text/Results
**Store**- Mark the Residuals box if you wish to store the residuals in the OxMetrics database.

### Auxiliary residuals graphics

### Prediction graphics

**Select type of predictions**-
Choose between One-step ahead and Multi-step ahead predictions.

Choose the post-sample size. **Plot predictions and Y**- Predictions can be plotted together with Y or with standard errors. They can also be scaled by a factor of choice or be cross-plotted against Y.
**Plot residuals**- The residuals of the predictions made can be plotted. These can also be plotted together with standard errors or scaled by some factor. Standardized residuals can also be plotted, as can the cumulative sum of the standardized residuals.
**Write**-
Mark the Prediction tests box if you wish to view the Prediction analysis the post-sample predictions and
the Post-sample predictive tests, which are the Chi^2 test and the Cusum t-test.

These will be shown in OxMetrics/Text/Results

### Forecasting

### Store in database

Allows you to save any of the listed items in the OxMetrics database. Note that forecasts must be generated using Test/Forecast before they can be stored.

OxMetrics will prompt for a variable name.

# Appendix

### Lags

When creating lags, STAMP appends the lag length as extra characters in a name, preceded by an underscore. E.g. CONS_1 is CONS one period lagged.

Lagging a variable leads to the loss of observations, but seasonals can be lagged up to the frequency without loss. STAMP handles variables in models through lag polynomials.

Sample periods are automatically adjusted when lags are created.

STAMP stores the lag information, and uses it to recognize lagged variables for Dynamic Analysis. Lags created this way are not physically created, and do not consume any memory. However, when you compute a lag using the calculator, a new variable will be created in the database, which will NOT be treated as a lagged version of that variable, but as any other variable.

### Ordinary Least Squares (OLS)

Ordinary Least Squares is the standard textbook method. OLS is valid if the data model is congruent.

### Numerical optimization

Numerical optimization is used to maximize the likelihood log
L(**θ**) as an unconstrained non-linear
function of **θ**.

STAMP maximization algorithms are based on a Newton scheme:

**θ**

_{k+1}=

**θ**

_{k}+

*s*

_{k}

**Q**

_{k}

^{-1}

**q**

_{k},

with

**θ**parameter value at iteration k- s step length, normally unity
**Q**symmetric positive-defnite matrix (at iteration k)**q**first derivative of the loglikelihood (at iteration k) (the score vector)-
Δ
**θ**_{k}=**θ**_{k}-**θ**_{k-1}is the change in the parameters

STAMP and STAMP use the quasi-Newton method developed by Broyden,
Fletcher, Goldfarb, Shanno (BFGS) to update **K** = **Q**^{-1} directly,
estimating the first derivatives numerically.

Owing to numerical problems, it is possible (especially close to
the maximum) that the calculated **θ** does
not yield a higher likelihood. Then an s in [0,1] yielding a higher function
value is determined by a line search. Theoretically, since the direction is
upward, such an s should exist; however, numerically it might be impossible to find one.

- The convergence decision is based on two tests:
- 1. based on likelihood elasticities (dlogLik/dlog|
**θ**|) (scale invariant):| q _{k,j}θ_{k,j}| ≤ epsfor all *j*when θ_{k,j}not zero,| q _{k,j}| ≤ epsfor all *j*when θ_{k,j}= 0. - 2. based on the one-step-ahead relative change in the parameter values
(assuming step length 1) (scale variant, but relative change is infinite
if any θ = 0)
| θ _{k+1,j}- θ_{k,j}| ≤ 10 * eps * | θ_{k,j}|for all *j*when θ_{k,j}not zero,| θ _{k+1,j}- θ_{k,j}| ≤ 10 * epsfor all *j*when θ_{k,j}= 0.

The status of the iterative process is given by the following messages:

- No convergence!
- Aborted: no convergence!
- Function evaluation failed: no convergence!
- Maximum number of iterations reached: no convergence!
- Failed to improve in line search: no convergence!

s has become too small.

Test 1 was passed, using eps2. - Failed to improve in line search: weak convergence.

s has become too small.

Test 1 was passed, using eps2. - Strong convergence

Both tests were passed, using eps1.

The chosen default values are: eps1 = 1E-4, eps2 = 5E-3.

You can:

- Set the initial values of the parameters to zero or the previous values;
- Set the maximum number of iterations;
- Write iteration output;
- Change the convergence tolerances eps1 and eps2;
- Care must be exercised with this: the defaults are `fine-tuned': some selections merely show the vital role of sensible choices!
- Choose the maximization algorithm;
- Plot a grid of the log-likelihood.

The `fineness', number of points and centre can be user-selected. Up to 16 grids can be plotted simultaneously. A grid may reveal potential multiple optima.

Options 1., 5. and 6 are mainly for teaching optimization.

NOTE: estimation can only continue after convergence.

### Correlations

The correlation matrix of selected variables is a symmetric matrix, with the diagonal equal to one. Each cell records the simple correlations between the two relevant variables.

The mean:

*m*=

*T*

^{-1}Σ

^{T}

_{i=1}

*x*

_{i},

and standard deviation:

*s*= (

*T*-1)

^{-1}Σ

^{T}

_{i=1}(

*x*

_{i}-

*m*)

^{2}

of the variables are also given.

NOTE that the standard deviation here is based on 1/(T-1).

### Data density and histogram

Histograms are a way of looking at the sample distributions of statistics. Then, on the basis of the original data, density functions may be interpolated to give a clearer picture of the implied distributional shape: similarly, cumulative distribution functions may be constructed (and compared on-screen to a Cumulative Normal Density).

#### Non-parametric density estimation

Given observations:

*x*

_{1}...

*x*

_{T})

from some unknown probability density function f(X),
about which little may be known a priori. To estimate that density without
imposing too many assumptions about its properties, a non-parametric
approach is used in STAMP based on a kernel estimator.
The kernel *K* used is the Normal or Gaussian kernel.
Research suggests that the density estimate is little affected by the
choice of kernel, but is largely governed by the choice of window width, *h*.

Owing to the importance of the window width *h* in estimating the density,
the non-parametric density estimation menu offers control over the choice
of window width, *h* = Cσ*T*^{P}.
By default, *P* = -0.2 and *C* = 1.06 in STAMP.
For normal densities this choice will minimize the Integrated Mean Square Error.

For more information see:
Silverman B.W. (1986). *Density Estimation for Statistics and Data Analysis*,
London: Chapman and Hall.

### Correlogram (ACF, PACF)

The correlogram or autocorrelation function (ACF) of a variable, or of the residuals
of an estimated model, plots the series of correlation coefficients
{ *r*_{j} } between *x*_{t} and
*x*_{t-j}.

The length s of the ACF is chosen by the user,
leading to a figure which shows (*r*_{1}, *r*_{2}, ..., *r*_{s})
plotted against (1,2,..., s).

A related statistic is the Portmanteau (also called Box-Pierce or Q-statistic):

*T*Σ

^{s}

_{j=1}

*r*

_{j}

^{2}.

The partial autocorrelation coefficients correct the autocorrelation for the effects of previous lags. So the first partial autocorrelation coefficient equals the first normal autocorrelation coefficient.

### Spectrum

A stationary series can be decomposed in cyclical components with different frequencies and amplitudes. The spectral density gives a graphical representation of this. It is symmetric around 0, and only graphed for [0,π] (the horizontal axis in the STAMP graphs is scaled by π, and given as [0,1]).

The spectral density consists of a weighted sum of the autocorrelations, using the Parzen window as the weighting function. The truncation parameter m can be set (the larger m, the less smooth the spectrum becomes, but the lower the bias).

A white-noise series has a flat spectrum.

### Diagnostic testing

**Test types**-
Many tests report a Chi^2 and an F form. In the summary, only the F-test is reported, which is expected to have better small-sample properties.

F-tests are usually reported as

F(num,denom) = Value [Probability] /*/** For example

`F(1, 155) = 5.0088 [0.0266] *`where the test statistic has an F distribution with 1 degree of freedom in the numerator, and 155 in the denominator. The observed value is 5.0088, and the probability of getting a value of 5.0088 or larger under this distribution is .0266. This is less than 5% but more than 1%, hence the star.

Significant outcomes at a 1% level are shown by two stars: **.

Chi^2 tests are also reported with probabilities, as e.g.:

`Normality Chi^2(2)= 2.1867 [0.3351]`The 5% Chi^2 critical values with 2 degrees of freedom is 5.99, so here normality is not rejected (alternatively, Prob(Chi^2 ³ 2.1867) = 0.3351, which is more than 5%).

**Normality**-
The Normality test checks whether the variable at hand (either a
database variable or the residuals), here called
*u*, are normally distributed as:*u*_{t}~ IN(0,1) with E[*u*_{t}^{3}] = 0, and E[*u*_{t}^{4}] = 3σ^{2}.A Chi^2 test is reported (with 2 degrees of freedom), and the output includes all moments up to the fourth. The null hypothesis is normality, which will be rejected at the 5% level, if a test statistic of more than 5.99 is observed.

### Matrix File

Seceral formats are available to load and save matrices:

**in7**, the OxMetrics format.**xls**, the Excel format.**csv**, the comma-separated spreadsheet format,**mat**, a text file with a matrix, preceded by the matrix dimensions.

+---------+ ¦ 2 3 ¦ <-- dimensions, a 2 by 3 matrix ¦//comment¦ <-- a line of comment ¦ 1 0 0 ¦ <-- first row of the matrix ¦ 0 1 .5 ¦ <-- second row of the matrix +---------+ ### Missing values

In STAMP, any missing observation is automatically incorporated in the analysis.