43
USING A GENETIC PROGRAM TO USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE PREDICT EXCHANGE RATE VOLATILITY VOLATILITY Christopher J. Neely Paul A. Weller

USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

  • View
    222

  • Download
    1

Embed Size (px)

Citation preview

Page 1: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

USING A GENETIC PROGRAM TO USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE PREDICT EXCHANGE RATE

VOLATILITYVOLATILITY

Christopher J. Neely

Paul A. Weller

Page 2: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Introduction The Genetic Program Data and Implementation Experimental Designs Results Conclusion Discussion

Outline

Page 3: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Introduction Exchange rate volatility displays considerable

persistence. Large movements in prices tend to be followed by

more large moves, producing positive serial correlation in absolute or squared returns.

Engle (1982) ARCH model Bollerslev (1986) GARCH model This paper investigates the performance of a

genetic program as a non-parametric procedure for forecasting volatility in the foreign exchange market.

Page 4: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Strength and Weakness Strength

Genetic programs have the ability to detect patterns in the conditional mean of foreign exchange and equity returns that are not accounted for by standard statistical models (Neely, Weller, and Dittmar 1997; Neely and Weller 1999 and 2001; Neely 2000).

Weakness Over fitting

Page 5: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The Genetic Program Function Set Data functions

data, average, max, min, and lag. Four data series Three more complex data functions

geo, mem, arch5 An Example of a GP Tree Volatility

Page 6: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Function Set plus, minus, times, divide, norm, log,

exponential, square root, and cumulative standard normal distribution function.

Page 7: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Four data series Daily Returns Integrated Volatility

the sum of squared intraday returns The sum of the absolute value of

intraday returns Number of days until the next business

day

Page 8: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The function geo returns the following weighted average of 10 lags of past data.

This function can be derived from the prediction of an IGARCH specification with parameter , where we constrain to satisfy 0.01 0.99 and lags are truncated at 10.

9

0

1))((j

jtj datadatageo

Page 9: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The function mem returns a weighted sum similar to that which would be obtained from a long memory specification.

j>0 hj=1

d is determined by the genetic program and constrained to satisfy -1< d <1.

Page 10: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The function arch5 permits a flexible weighting of the five previous observations.

hj are provided by the genetic program

and constrained to lie within {-5,5} and to sum to one.

Page 11: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller
Page 12: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Volatility Since true volatility is not directly

observed, it is necessary to use an appropriate proxy in order to assess the performance of the genetic program. Use the ex post squared daily return.

Andersen and Bollerslev (1998) A better approach is to sum intraday

returns to more accurately measure true daily volatility (i.e., integrated volatility).

Page 13: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Si,t is the i-th observation on date t

2i,t is the measure of integrated volatility on date t.

More precisely, daily volatility is calculated from 1700 GMT to 1700 GMT.

Using five intraday observations represents a compromise between the increase in accuracy generated by more frequent observations and the problems of data handling and availability that arise as one moves to progressively higher frequencies of intraday observation.

Page 14: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Data and Implementation Dollar / German mark (DEM) Dollar / Japanese yen (JPY) June 1975 to September 1999.

Training period June 1975 – December 1979 Selection period January 1980 – December 30, 1986 Out-of-sample period December 31, 1986 –

September 21, 1999 The sources of the data Step

Page 15: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The sources of the data

Page 16: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Step1. Create an initial generation of 500 randomly generated

forecast functions.

2. Measure the MSE of each function over the training period and rank according to performance.

3. Select the function with the lowest MSE and calculate its MSE over the selection period. Save it as the initial best forecast function.

4. Select two functions at random, using weights attaching higher probability to more highly-ranked functions. Apply the recombination operator to create a new function, which then replaces an old function, chosen using weights attaching higher probability to less highly-ranked functions. Repeat this procedure 500 times to create a new generation of functions.

Page 17: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

5. Measure the MSE of each function in the new generation over the training period. Take the best function in the training period and evaluate the MSE over the selection period. If it outperforms the previous best forecast, save it as the new best forecast function.

6. Stop if no new best function appears for 25 generations, or after 50 generations. Otherwise, return to stage 4.

Page 18: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Experimental Designs Benchmark Fitness Function Measure of Forecast Errors Forecasts Aggregation Other Designs

Page 19: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Benchmark GARCH (1,1)

Page 20: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Fitness Function MSE MSE + Penalty

Page 21: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Overfitting Penalty Function for Node Complexity This consisted of subtracting an amount

(0.002 * number of nodes) from the negative MSE. This modification is intended to bias the search toward functions with fewer nodes, which are simpler and therefore less prone to overfit the data.

Page 22: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Measure of Forecast Errors mean square error mean absolute error R-square mean forecast bias kernel estimates of the error densities.

Page 23: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Forecasts Aggregation The forecasts were aggregated in one

of two ways. Mean: The equally-weighted forecast is the

arithmetic average of the forecasts from each of the ten trials.

Median: The median-weighted forecast takes the median forecast from the set of ten forecasts at each date.

Page 24: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Other Designs forecast horizon: 1, 5, 10 the number of data functions: 5, 8 penalty for complexity: absent, present

Page 25: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Results An example of a one-day ahead forecasting

functions for the DEM In-sample comparison of GP and GARCH Out-of- sample comparison of GP and GARCH Out-of- sample results using the data functions

geo, mem, arch5

Kernel estimates of the densities of out-of sample forecast errors

Tests for mean forecast bias -- Newey-West correction for serial correlation

Summary

Page 26: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

An example

Page 27: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

In-sample comparison of GP and GARCH

The equally-weighted forecast is the arithmetic average of the forecasts from each of the ten trials.

The median-weighted forecast takes the median forecast from the set of ten forecasts at each date.

Page 28: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

In-Sample That is, its best relative performance is

at the twenty-day horizon. The median weighted forecast is

generally somewhat inferior to the equally weighted forecast.

Page 29: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Out-of- sample comparison of GP and GARCH

< <

< <

Page 30: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Out-of-Sample With MSE as the performance criterion,

neither the genetic program nor the GARCH model is clearly superior.

The GARCH model achieves higher R^2 in each case.

But the MAE criterion clearly prefers the genetic programming forecasts.

Page 31: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Out-of- sample results using the data functions geo, mem, arch5

Page 32: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Effect of Advanced Functions We have established that neither

imposing a penalty for complexity nor expanding the set of data functions leads to any appreciable improvement in the performance of the genetic program.

Page 33: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Effect of the Penalty Function This had very little effect and if anything

led to a slight deterioration in out-of-sample performance.

Page 34: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Kernel estimates of the densities of out-of sample forecast errors

The appearance of greater bias in the GARCH forecasts is illusory.

Page 35: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The most striking feature to emerge from these figures is the apparent bias in the GARCH forecasts when compared to their genetic program counterparts.

Page 36: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Tests for mean forecast bias Though both forecasts are biased in the

mean, the magnitude of the bias is considerably greater for the genetic program.

Page 37: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Summary While the genetic programming rules did not

usually match the GARCH(1,1) model's MSE or R^2 at 1-and 5-day horizons, its performance on those measures was generally close.

But the genetic program did consistently outperform the GARCH model on mean absolute error (MAE) and modal error bias at all horizons and on most measures at 20-day horizons.

Page 38: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Conclusion GP did reasonably well in forecasting out-of-

sample volatility. While the GP rules did not usually match the

GARCH(1,1) model’s MSE or R2 at 1- and 5-day horizons, its performance on those measures was generally close.

GP did consistently outperform the GARCH model on mean absolute error (MAE) and modal error bias at all horizons and on most measures at 20-day horizons.

Page 39: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Discussion Choice of Function Sets

Simple Functions (Primitive Functions) Complex Functions

Use of Data Functions True Volatility The Selection Period

Page 40: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

Use of Data Functions The data functions can operate on any

of the four data series we permit as inputs to the genetic program.

data, average, max, min, and lag.

Page 41: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

True Volatility The functions generated by the genetic

program produce forecasts of volatility. Since true volatility is not directly

observed, it is necessary to use an appropriate proxy in order to assess the performance of the genetic program.

Page 42: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The Selection Period What is the difference between Neely’s GP

and the regular GP? Neely introduced a new termination criterion,

which is based on the recent progress. This idea itself is not new.

What makes Neely’s idea unique is that the progress is measured by a ``testing sample’’, which he called it the selection period.

Page 43: USING A GENETIC PROGRAM TO PREDICT EXCHANGE RATE VOLATILITY Christopher J. Neely Paul A. Weller

The Selection Period Neely’s GP can be considered as another

approach to avoid over-fitting. Because one characteristic of over fitting is

the feature that the in-sample performance is improving, while the post-sample performance is stagnated or get worse.

Use Szpiro (2001)’s three-stage development of GP in data mining as a reference.

This is similar to the early stopping criterion frequently used in the artificial neural nets.