ABSTRACT:
We describe in this paper a new method to perform automated mathematical modelling for jnancial time series
prediction using Fuzzy Logic Techniques, Dynamical Systems and Fractal Theory. The main idea in this paper is
that using Fuzzy Logic techniques we can simulate and automate the reasoning process of the human experts in
mathematical modelling forjnancial time series prediction. Our new method for automated modelling consists of
three main parts: Time Series Analysis, Developing a set of Admissible Models and Selecting the "Best" modef.
Our method for Time Series Analysis consists in the use of the fractal dimension of a set of points as a measure of
the geometrical complexity ofthe time series. Our method for developing a set of admissible dynamical systems
models is based on the use of Fuzzy Logic techniques to simulate the decision process of the human experts in
modelling fkancial problems. The selection of the "best" model for Financial Time Series Prediction (FTSP) is
done using heuristics from the experts and statistical calculations. This new method can be implemented as a
computer program and can be considered an intelligent system for automated mathematical modelling for FITP.
1. INTRODUCTION
We describe in this paper a new method to perform automated mathematical modelling for FTSP using Fuzzy
Logic techniques, Dynamical Systems and Fractal theory. The idea of using Dynamical Systems Theory and
Fractal Theory as alternative approaches for predxtion can be justified if we consider that traditional statistical
methods only have limited success in real world complex financial applications, and this is mainly because many
financial problems show very complicated dynamics in time. Traditional statistical methods assume that the erratic
behavior of a time series is mainly due to a external random error (that can not be explained). However, a
Dynamical Systems approach, using nonlinear mathematical models, can explain this erratic behavior because
"chaos" is an intrinsic part of this type of models. It is a well known fact from Dynamical Systems (Devaney, 1989)
that even very simple nonlinear mathematical models can exhbit the behavior known as "chaos" for certain
parameter values, and therefore are good cankdates to use as equations for prediction in complex financial
situations. Fractal Theory (Mandelbrot, 1983) also offers a way to explain the erratic behavior of a time series, but
the method is geometrical in the sense that the fractal dimension is used to describe the complexity of the
distribution of the data points.
We describe a prototype implementation of our new method for Automated Mathematical Modelling
(AMM) as a computer program written in the PROLOG programming language. This computer program can be
considered an intelligent system for the domain of FTSP because it uses Artificial Intelligence (AI) techniques to
obtain the "best' mathematical model for a given financial problem. The use of AI techniques is to achieve the goal
120
of automated modelling of financial problems by simulating (in the computer) how human experts in this domain
obtain the "best" model for a given problem. Given a financial time series the intelligent system develops
malhematical models based on the geometry of the data. The method for A M M consists of three main parts: Time
Series Analysis, Developing a Set of Admissible Models and Selecting the Best Model. First, the computer
program uses the fractal dimension to classify the components of the time series over a set of qualitative values,
then the program uses this information to decide (using a fuzzy rule base) which dynamical models are the most
appropriate for the data, and finally the program decides which model is the "best' one for prediction using
heuristics and statistical calculations. In i3 prior prototype intelligent system developed by the authors (Castillo &
MeXin, 1995) the method used didn't consider using the fractal dimension as a measure of classification and also
didin't consider a fuzzy rule base for the simulation of the decision process. The use of Fuzzy logic in financial
applications has been well recognized (Deny, 1994) and many applications have been developed. in this case we
came to the conclusion that the best way to convey the information of financial modelling problems was using
f u z q sets (Badiru, 1992). Also, we think that the best way to reason with uncertainty in this case is using Fuzzy
Logic.
The intelligent system develops only the kind of mathematical models that are more likely to give a "good'
preldiction based on the knowledge that human experts have about this matter. This knowledge is contained in the
knowledge base of the intelligent system, and is the main factor in limiting the number of models that the system
explores. The intelligent system also has some generalized knowledge about the mathematical models that we
expect to discover in the financial domain. This knowledge is expressed as families of parametrized mathematical
models.
Financial forecasting systems are necessarily limited by the data presented to them. Afterall, it is the data upon
which they make decisions or estimates. Therefore, for any given market of interest, one must determine which
data is relevant to the overall requirements. In the case of financial forecasting systems, such data is often derived
from various time series, usually represented as prices and volumes, but also as open interest, dividends. etc.
Sufficient "historical" data is needed for developing software tools intended to extract characteristics of previous
market behavior in an effort to apply this knowledge to trading or investing in the "future" market (Caldwell,
1994).
Many financial time series are composed of relatively longterm trends plus some degree of periodic and
noiselike components. Periodic components may include those related to seasonalities or limitcycles in the data.
The linearities and periodicities of the series can be removed, leaving the random or noiselike components. Such
noiselike components may truly be randalm and be describable by a probability distribution function. On the other
hand, they may only appear to be random and/or nonperiodic, while actually representing an underlying
deterministic nonlinear dynamic time series. In fact, our hypothesis is that in many financial problems this is the
case. and that "chaotic" time series are present in different scales and for different kinds of data. Some evidence on
the correctness of this hypothesis has been found over the years by several researchers. Brock (1988) has found
evidence of complex dynamics in stock returns and strong evidence of "chaotic" behavior on Tbill returns.
Eckman et. al. (1988) also found evidence of nonlinear dynamics in time series of weekly stock returns. Castillo
(1991) also found evidence of nonlinear dynamics in time series of world oil prices. Jurik (1994) described a
method potentially useful for determining the forecast horizon for TBonds using "Chaos Analysis". This evidence
is the main reason why we are considering nonlinear dynamical systems models in our space of mathematical
models for the computer system.
With all of this in mind our goal in this paper is to show how AI techniques can be used to automate the
process of discovering the best model for a financial problem. The human financial experts usually try several (in
some cases many) mathematical models before they are satisfied with the "goodness" of one model. The experts use
their knowledge about modelling financial problems to limit their search of models, in this way obtaining the
"best" results as quickly as possible. The "goal" of our work is to capture this knowledge of modelling in a
computer program, in this way obtaining a software tool capable of emulating intelligent behavior in this domain.
In the remaining sections of this paper we: describe the basic algorithm for discovering mathematical models, then
121
the implementation of the algorithm as a computer program and finally we discuss some lines of future research
work in this area.
Our new method for solving the financial modelling problem is based on several novel ideas. We consider
that the financial modelling problem can be divided in three main parts: Time Series Analysis, Selection of
Appropriate Models and Selection of the Best Model. The first part of the problem consists in obtaining the time
series components from the data. Our solution to this part of the problem is a new classification scheme based on
the notion of the fractal dimension . This classification scheme is a one to one map between the fractal dimension
of the data set and the qualitative values for the components of the time series. Once this part of the problem is
solved. the second part consists in simulating an expert decision process that gives us the set of Mathematical
Models appropriate for the geometry of the time series. This expert decision process is simulated using AI
techniques and is the main part of the intelligent system. The third part of the problem consists in designing a
method to compare all the models obtained in the second part, to obtain which one is the "best" model for
predicting the time series. Our method to compare all the models has to consider statistical measures of goodness
between nonlinear dynamical systems and linear statistical models, to decide which model fits best the data set
(time series).
122
The mathematical models for continuous dynamical systems can be onedimensional, twodimensional or
threedimensional. We show below some sample models (Rasband, 1990) that the intelligent system explores:
The mathematical models for discrete dynamical systems can also be one, two or three dimensional. We
show below some sample models (Rasband, 1990) that the intelligent system explores:
In all of the above mathematical models a, b and c are parameters that need to be estimated using the
corresponding numerical methods. For example, for the regression models we can use the least squares method for
parameter estimation, but for the differential equations we need to use a GaussNewton type method.
The algorithm for automated mathematical modelling for prediction is shown in Figure 1.
~ ~~~ ~~ ~~~ ~~
We call this algorithm IDIMM (for Intelligent Discovery of Mathematical Models) and is an integration
of Artificial Intelligence techniques with Dynamical Systems Theory, Fractal Theory and Statistical Methods, to
obtain mathematical models for prediction of time series in the financial domain. In the following section we will
show how this algorithm can be implemented to achieve the goal of AMM for FTSP.
The implementation of the method for NUM as a computer program was done using the PROLOG programming
language. The choice of PROLOG is because of its symbolic manipulation features and also because it is an
excellent language for developing Prototypes (Bratko, 1990). The computer program was developed using an
architecture very similar to that of an intelligent system (knowledge base, inference engine and user interface) with
the addition of a numerical module for parameter estimation. We will focus our description of implementation
details only to the knowledge base of the intelligent system. In the computer program, the knowledge base is the
pafit that simulates the process of model discovery described by step 1 to 4 in the algorithm of the last section.
Accordingly, the knowledge base consists of three Expert Modules: Time Series Analysis, Expert Selection and
Best Model Selection. In the following lines we will describe briefly each of this modules.
123
complexity of the time series. We use the value of the fractal dimension to classify the time series components over
a set of qualitative values. Our classification scheme was obtained by a combination of expert knowledge and
mathematical modelling for several samples of data. To give an idea of this scheme we show in Table 1 some
sample rules of this module.
IF THEN
Fractal_dimension(D)E(0.8,1.2) Trend = linear, Timeseries = smooth
Fractaldimension(D)E [1.2,1.5) Trend = nonlinear, Timeseries = cyclic
Fractaldimension(D) E [ 1.5,l.8) Timeseries = erratic
Fractaldimension(D)E [ 1.2,1.4) Periodicqart = simple
Fractaldimension(D)E [ 1.4,1.6) Periodicqart = regular
Fractaldimension(D) E [ 1.6,l.7) Pericldicgart = difficult
Fractaldimension@)€ [ 1.7,l.S) Periodicgart = veqdifficult
Fractal dimension(D)>l.S Periodic part = chaotic
We performed several experiments with real data sets to decide on the classification needed for this "Time
Series Analysis Module" and we found that for the moment classifying the periodic components in "simple",
"regular", "difficult" and "chaotic" was sufficient. Also, we only classify the "trend" component in two kinds:
"linear" and "nonlinear". Of course, it is possible that we may need a better classification in the future, for a more
accurate implementation of this Module, but now we are only showing how the method can be implemented.
In conclusion our method for time series analysis consists of a one to one mapping between the fractal
dimension of the set D and the qualitative values of the time series components. This set of qualitative values for
the components is the information needed as input for the "Expert Selection Module" (implementing Step 3 of the
algorithm).
IF THEN
Dim Trend Periodicqart TypeModel
one nonlinear simple logisticdifferentialequation
two nonlinear simple lotkavolterradifferentialequation
three nonlinear regular lorenzdifferentialequation
one nonlinear simple logisticdifferenceequation
two noqlinear regular lotkavolterradifferenceequation
The rules in Table 2 show how this expert module selects the appropriate models for a given financial
problem, using as information the dimensionality of the problem and the qualitative values of the time series
components. Each rule of this expert module contains a piece of knowledge about the problem of model selection.
124
4.3 Description of the Best Model Selection Module
This module is the implementation of step 4 of the algorithm and contains the knowledge to select the "best"
mathematical model for prediction, i.e., ghen the set of selected models generated by step 3, decide which model is
the "best" one to predict the time series. Our method for selecting the "best' model consists of comparing the Sum
of Squares of Errors (SSE) for all the models and selecting the one that minimizes SSE. This criteria has the
advantage of been valid for all the types of models that we consider for the intelligent system (statistical models
and nonlinear dynamical systems models). To give an idea of our method, we show in Table 3 a sample case
where the set of selected models is MS={MI, MZ, M3, M4, M5, M6} and the model with lowest SSE is M4.
Table 3. Method for best model selection using the SSE

 MODEL TYPE SQUARES SUM BEST MODEL
M1: Y = a l +bit Statistical SSE 1 no
M2: Y = a2 + b2t + c2t2 Statistical SSE2 no
M3: InY = h a 3 + b31nt Statistical SSE3 no
M4: logisticdifferentialeq Dynamical SSE4 Yes
M5: lotkavolterradifferenceeq Dynamical SSE5 no
Mg: lorenzdifferentialeq Dynamical SSE6 no

In Table 3 the best model is M4 because S E m i n = SSE4 where:
S E m i n = min(SSE1, S E 2 , S E 3 , S E 4 , SSE5, SSE6)
The implementation of this minimization procedure is easy once the numerical values of the Sum of the Squares
(SSE) are calculated by the numerical module.
There has been some work recently in the area of numerical law discovery, but much of the research in Machine
Learning is in other areas such as induction (Sleeman and Edwards, 1992). We think that this is mainly because
"discovery" is a more difficult kind of "learning". However, we can state that automated mathematical modelling is
very important for many domains of application for obvious reasons. For example in the engineering and financial
domains is critical to obtain mathematical models for the problems, to be able to understand them and also to be
able to predict their future behavior. This is why we consider that more research in this area is very important.
Similar work with respect to Machine Learning can be found in a paper by Moulet (1992), however the
approach to model discovery is different to ours (this can be seen from the heuristic method by Moulet). Also in a
paper by Rao and Lu (1993) we can see a method for model discovery for engineering domains, but also with a
different approach to ours (his approach i!; similar to "clustering"). Also, there is another very important difference
witlh other authors, in the kind of mathematical models that we are considering for our intelligent system. We are
considering nonlinear mathematical modlels from the theory of Dynamical Systems and not only linear regression
models like other authors. In this paper we have successfully generalized our previous work on this matter (Castillo
and Melin, 19941, by considering this type of nonlinear models.
6. CONCLUSIONS
We described in this paper a new method to perform automated mathematical modelling for financial time series
prediction. Also, we described the implementation of this new method as a prototype intelligent system for the
domain of financial problems. We have tested this computer program with real financial data with encouraging
results. In this paper we have successfully generalized our previous work on this matter (Castillo & Melin, 1994)
by using nonlinear dynamical systems models. Also, we have improved our work presented last year in this forum
(Castillo & Melin, 1995) by using the fractal dimension for time series analysis and by using Fuzzy Logic
125
techniques for the simulation of the expert reasoning process. The importance of our work can be measured if we
consider that accurate prediction is critical in the areas of Finance, Economics, Management and Accounting. We
think that our work can help in making more easy the job of mathematical modelling and prediction in all of these
areas.
The implementation of our new method for Automated Mathematical Modelling can be improved in
several ways. First of all, the Time Series Analysis Module can be improved by designing a better classification
scheme using the fractal dimension (with t h s malung it more accurate). Second of all, in the Expert Selection
Module we can increase the number of different mathematical models that can be used for the financial domain, in
this way making the intelligent system capable of solving a bigger variety of problems. Finally, we think that other
AI techniques can be tested for the implementation of our method for AMM with the idea of possibly improving
efficiency. We are planning to follow this lines of research in the near future.
ACKNOWLEDGMENTS
The authors would like to thank the Research Grant Committee of UABC University for supporting this project,
the Department of Economics of UABC University for the time and resources given to this project and the School
of Engineering of CETYS University for the collaboration in this research and for providing the Computing
facilities needed for this research work.
REFERENCES
Badiru, A.B. (1992). "Expert Systems Applications in Engineering and Manufacturing", PrenticeHall.
Bratko, I. (1990). "Prolog Programming for Artificial Intelligence", Addison Wesley.
Brock, W.A., 1988. "NonLinearity and Complex Dynamics in Economics and Finance", The Economy as an
Evolving Complex System, Edited by Anderson, P.W., Arrow, K.J., Pines, D, Addisson Wesley, 5, 7797.
Caldwell. R.B. 1994. "Design of Neural Networkbased Financial Forecasting Systems: Data Selection and Data
Processing", Neurovest Journal, 2 (3,1220.
Castillo, 0. 1991. TJna Introduccibn a1 Estudio del Caos en Sistemas Dinamicos. Su Aplicacion en Economia
Matematica", Cuadernos de EconomiaNo.4, Editorial UABC.
Castillo, 0. and P. Melin (1994). "An Intelligent System for Discovering Mathematical Models for financial time
Series Prediction", Proceedings of the IEEE Region 10's Ninth Annual International Conference, pp. 2 17221,
IEEE Computer Society of Singapore.
Castillo, 0. and P. Melin (1995). "An Intelligent System for Financial time Series Prediction Combining
Dynamical Systems Theory, Fractal Theory and Statistical methods", Proceedings of the IEEE/IAFE 1995
Conference on Computational Intelligence for financial Engineering (CIFER), pp. 151 155.
Derry, J. (1994). A Fuzzy Expert System and Market Psychology", NeuroVest Journal, Vol. 2, No. 1, pp. 2022.
'I
Devaney, R. (1989). "An Introduction to Chaotic Dynamical Systems", Addison Wesley Publishing Company.
Eckmann, J.P.,Kamphorst, S.Q., Ruelle D. and Scheinkman J., 1988 "Lyapunov Exponents for Stock Returns",
The Economy as an Evolving Complex System, Edited by Anderson, P.W., Arrow. K.J., Pines, D. Addisson
Wesley, 5, 301304.
Jurik, M., 1994. "Estimating Optimal Forecast Distance using Chaos Analysis", Neurovest Journal, 2(1), 1119.
Mandelbrot, B. (1983). "The Fractal Geometry of Nature", W. H. Freeman and Company.
Mendenhall, W. and J.E. Reinmuth (198 1). "Statistics for management and Economics", Wadsworth International.
Rasband, (1990). "Chaotic Dynamics of NonLinear Systems", John Wiley & Sons.
Rao, R. B. and S. Lu (1993). "An KnowledgeBased Equation Discovery System for engineering Domains, IEEE
Expert, pp. 3742.
Sleeman, D. and Edwards P. 1992. Proceedings of the Ninth International Workshop on Machine Learning,
Morgan Kauf€man Publishers, San Mateo, CA.
126