Thursday, August 17, 2023

70. OPTIMAL RISK , LIQUIDITY STRATEGIES FOR FAVORABLE GAMES

  To scroll down the pages, left click on the number of pages and then double left lick in the middle of the page. Then use the page down-up buttons of the keyboard.

\

Sunday, January 15, 2017

65. THE IMPACT OF THE CONVERGENCE OF THE GREEK ECONOMY TO EMI IN THE STOCKMARKET: BAYES, NESTED ESTIMATION OF THE STOCK TRENDS

THE IMPACT OF THE CONVERGENCE OF THE GREEK ECONOMY TO EMI IN THE STOCKMARKET: BAYES, NESTED ESTIMATION OF THE STOCK TRENDS


                                                By Dr. Costas Kyritsis
                                    National Technical University of Athens 1999


1. Introduction
The time when an economy enters the first world economy is a very interesting time. It is even more interesting if the group of nations where it enters, in this case European Union, becomes gradually, with respect to some parameters, the strongest economy in the world.
Although the Greek economy is by far not perfect or advanced, there is the firm decision to handle its indices, as much as possible, so as to qualify according to the standards of European Monetary Integration. These standards are set, for the Greek economy, mainly in the next profile:
a) The Inflation rate less than 1.5%
b) The deficit of the Government less than 0.9% of the Gross National Product
c) The national debt less than 100% of the Gross National Product
d) Growth rate of the Gross National Product at least 4.5%.

2. Macroeconomics factors influencing the prices in the Athens Stockmarket
There is no doubt that the previous standards of EMI make a profile of a mature economy and also no doubt that a young state like the Greek  (less than 2 hundred years old) has major difficulties in qualifying in the profile of EMI, before 2001 .It is worth trying nevertheless, even only for the benefit of eliminating the continuous currency devaluation of the national wealth through the exchange rates.
Experience has showed that the basic magnitudes of Macroeconomics that have significant impact on the changes of prices of stocks in the Stockmarket are:
a) The average rate of deposit in the banks, or the rate of change of the time-value of money.
b) The exchange rates 
c) Mass-media information about other economies and changes of prices in other Stockmarkets.
The procedures with which the previous factors influence the changes of prices in Stockmarket is always through the aggregate demand and supply for each stock:
1) Surplus of demand to purchase stocks in the computer waiting lines creates growth of the price of the stock (Bull-market)
2) Surplus of supply to sell stocks in the computers waiting lines creates falling of the price of the stock (Bear-market)
The exact equations of how stochastic demand and supply results in to the random variables of price and volume and their changes, is not an issue to cover in the present paper. It is not of intractable difficulty to formulate though.
We shall state, nevertheless, the basic equations of competition of demand and supply for each stock. The equations of two populations in competition have been a topic of systematic study. It may not be surprising that such equations have been studied and solved not in the science of Economics but in Ecology. They are a standard topic in an area initiated by Volterra and his equations for populations.
Let us denote by x (tn) and y(tn)  the average   value,  at  time   tn  of the  random variable of the volume of orders of the demand to buy and of the volume of  orders of the supply to sell  a stock. The next equations describe the interplay of demand and supply:

(1) x(tn+1)= x (tn)(a-b x (tn)-c y(tn))
(2) y(tn+1)= y (tn)(e-f x (tn)-g y(tn))

The symbols a, b, c, d, e, f. g are constants defining the competition.
Such equations, formulated in continuous time and deterministic mode are the well known equations of competition in Ecology (see e.g. [Maynard S.J] p 59 formula 36).We notice that they are non-linear equations. They have been solved numerically,  studied and applied in many situations of populations in competition .The populations involved here are of the investors who want to buy and those who want to sell .The equations describe the  effect in demand and supply of the automatic negotiation algorithm in the computers waiting lines . These equations if formulated in continuous time they do not involve oscillations. But when formulated in discrete time and as stochastic processes or time series, they do involve  (non-linear) oscillations which is the common experience for anyone that has spent some time in front of a monitor of a Stockmarket company. If we make use of the prey-predator or host-parasitoid , Volterra equations that different from the equations (1), (2) only at a plus sign instead of a minus sign at he coefficient f in (2), then we get  larger scale oscillation.
 During 1997 there was a major impact on the price growth in the Athens Stockmarket of the size, at year base, close to 50% .It is supposed that it was created by the fall  of the deposit rates of the banks (factor a) mentioned in this paragraph ).
During 1998 there was an even larger impact on the price growth of a size close to 70%. It is supposed that it was created mainly by the currency devaluation in the exchange rates decided by the government in March 1998.
As the latter case was the most dramatic, we shall try to analyze it with a new statistical method.

3. Bayes fractal-like nested estimation of time series
As it is known there is a topic in statistics called Bayes estimators. (See e.g. [Mood A.-Graybaill A.F.-Boes D.C.]  pp 339-351). The main idea is that when we have a parameter in a distribution that we must estimate, we may assume as a meta-level that it is already a random variable with an a priori given distribution . For example if we are estimating a Gaussian (normal) random variable N(m,s) we may assume that we have a double variation and a second stochastic level and that the parameters m, s are already Gaussian (normal) random variables with means mm , mand variances Sm Ss  . It is not that we want to make the computations more complicated but that we need to fit a more flexible model to the real situation.
For doubly stochastic time series see  [Tong H.] pp 117-118. We shall describe a general method to refine autoregressive time series models, such that at each refinement, it appears higher order variability and higher Bayes order as discussed above. For the sake of clarity we shall apply it to the Black-Scholes  lognormal model of the prices of stocks .The model is known in stochastic processes and stochastic differential equations as the geometric Brownian motion . (see [Oksendal B.]  pp  59-61 ,198-199 and 223-225 or  [Karlin S-taylor H.M.] pp 267-269 ,357 ,363,385 and [Mallaris A.G.-Brock W.A.]  pp 220-223. It is a linear SDE of constant coefficients and multiplicative  «noise» or innovation.
Although  much popularity is related to  this model, it cannot describe but the «buy-and-hold» situation in the Stockmarket . We may try to vary this model with the idea of Bayes so as to include reversal patterns and price motion with or without resistance. We supplement the idea of Bayes by corresponding to each new stochastic or Bayes level a finer grid of the argument .In this way different models appear to different scale regimes, but still something is repeated thus we follow also the basic idea of self-similarity introduced  graphically by Mandelbrot  with fractals and multi-fractals .
Mandelbrot has applied his idea of self-similar fractals to the Stockmarkets, arguing that much of the oscillating effects of stock prices are not observed in the Black-Scholes model.
There are many new results of qualitative dynamics of dynamic systems under the term «chaos». The ideas are not irrelevant but in order to apply them in a professional way to Stockmarkets we require them in  stochastic differential equations or time series (see [Tong H.])
The idea of nested patterns of «tides» (trend of a year or more) ,«waves» (in seasonal horizon) and «ripples» (day or intra-day oscillations ) goes back to the theory of Dow and Elliot in the Technical Analysis of stocks (see [Murphy J.J.] pp 24-35 ,371-414). [Murphy J.J.] . It is also obvious the relevancy of the Elliot wave theory with Spectral Analysis and fast Fourier transformation in time series.
The way to enhance the «buy-and-hold» model of Black-Scholes is as follows:
1) We define a nested system of grids in the time argument .For example starting with an horizon of a year we partition it to smaller seasonal horizons (e.g. 60 Stockmarket days). We may continue in this way to monthly, weekly and finally daily horizons .
2) For the first one year horizon we perform an ordinary estimation of the Black-Scholes model .It gives the buy-and-hold trend.
3) In the seasonal horizon we increase the Bayes stochastic order. For each season in the one year horizon we estimate a second Bayes order model. The four seasonal models are pasted automatically to a more flexible overall model than the Black-Scholes
4) We continue to increase the Bayes order by one for each finer horizon, of a month, a week or a day and we estimate a new model for each smaller horizon.
The resulting time series fits pretty well to the real life surprises of the Stockmarket .
The method resembles the splines in numerical analysis only that it is not performed on polynomials and the models are not deterministic but stochastic.
A good question is how we increase the Bayes order. A simple method is to consider the constant coefficients of the initial model as varying linearly relative to time. This introduces for estimation new constant parameters .At each finer grid we assume the previous constant parameters as varying linearly and we estimate the new constant parameters.
In the next paragraph we shall perform the method at two only horizons of one  year and a seasonal of 60 Stockmarket  days .




4. An example: The impact of  the currency devaluation  in the spring of 1998.
As we mentioned in the previous paragraph the Black-Scholes model of the prices of stocks is the geometric Brownian motion in other words defined in continuous time by the stochastic differential equation:
(3)   dx=rxdt+σxdz.
Where x is the price of the stock and z is a Brownian motion.
In this example we implement the discrete time, non-homogeneous time-series version defined by the equation
(4)     xn+1=(r+s en )xn

We make use of a close relative to it, which is the next time series in explicit form:

(5)  xn=exp(rn+sen)
Where eis a normal error or innovation. We do not insist on any stationarity assumption.
We make the  assumption that the «noise» or innovation term  is additive in the exponent  instead of multiplicative and of constant variance, that is, an homoskedasticity assumption that makes the variance of the residual, in the exponent, constant in time.
This simplifies the estimation of the parameters of the time series
The application of the original model of constant coefficients for an one year horizon is straightforward and is very well known. We proceed with the nested Bayes estimation that we described in the previous paragraph .We assume for the four seasonal (3-months) horizons of one year that the model has variable coefficients and that the coefficients vary linearly with respect to time. This introduces new constant coefficients a, b in (5) :        (rn= an+b)
The exponent becomes now quadratic with respect to time.
(6)  xn=exp((an+b)n+sen)
More generally we estimate the equation
(7)   xn=exp((an+b)n+c+ sen)
We notice that the equation is almost the normal curve except of a linear term or sign reversal.
To estimate it we take the logarithm of the prices and apply polynomial regression.
The exponent is in general an at most quadratic polynomial .If the coefficient of the quadratic term is negative, we have an instance of an almost Gaussian (normal) curve, which is interpreted as follows:
1) Increase of the prices with an asymptotic upper resistance, which becomes a reversal pattern (first part of the curve)
2) Decrease of the prices with an obvious asymptotic lower resistance at zero, thus practically without resistance (second part of the curve)
If the coefficient of the quadratic term of the exponent is positive then the probable cases are:
3) Increase of the prices very fast (faster than the simple exponential growth) without upper resistance (second part of the curve)
4) Decrease of the prices with lower asymptotic resistance that becomes a reversal pattern (first part of the curve)
Thus the qualitative dynamics of the stock at each time are described by the above four dynamic states
The results of the least squares estimation of this linear model with  time variable coeficients are given below.
The  estimated model between the dates 10/03/1998 (n=1) and  05/06/1998 (n=60),that is 60 Stockmarket days is
(8)  xn=exp(((-0,00025)n+0,023223)n+7,317873+ en)
The maximum of the normal curve occurs in the day n=47 that is in 19/05/98.
In this date the model gives a clear selling signal .Of course we cannot trade with the general index .But it would give one if we had applied it for a particular stock . The author scored  code in visual basic in Excell in order to analyse the buying and selling signals during the year.The results were quite positive for forecasting .For further analysis of optimal trading se bibliography below from BREIMAN L.1961 to  GENCAY  R. 1998.
The variance of the residual and the goodness of fit are given below:
(9) S= 8409,733584
(10) R= 92,62713729
The reader should be warned nevertheless, that a high goodness of fit of a forecasting model, for a particular short time interval, as the above, is not adequate for a repetitive,  trading based on it and for a long time (years). For a model to be used for repetitive trading and for a long time (years), it should be tested that for the goodness of fit at repetitive forecasting does remains high for long times intervals, that must me at least 2 to 5 years, but even better 20-25 years.
In figure 2 we have an superimposed form the general index and the estimated normal curve for the seasonal horizon of 60 days .
In table 1 they are given the numerical data of the chart .As soon as we have estimated the model by continuing it in a resaonable forward horizon we have an effective forecasting .The forecasting is corrected at best every day so that the buing or selling signals are with minimum time delay .
We have used data of closing daily prices and not intra-day data .
The Bayes nested estimation can be extended for shorter horizons and the exponent becames a polynomial of  order  higher than the  quadratic .

 Figure 2






Table 1
                                                            
                                               
                Date
General Index
Normal Smoothing
Date
General Index
Normal Smoothing
10.03.1998
1542,017
1517,54
24.04.1998
2437,958
2473,98
11.03.1998
1577,069
1531,26
27.04.1998
2456,469
2300,71
12.03.1998
1612,116
1543,62
28.04.1998
2473,89
2445,80
13.03.1998
1647,124
1537,37
29.04.1998
2490,196
2511,56
16.03.1998
1682,055
1649,69
30.04.1998
2505,364
2621,44
17.03.1998
1716,873
1737,37
04.05.1998
2519,372
2602,82
18.03.1998
1751,541
1754,93
05.05.1998
2532,2
2634,54
19.03.1998
1786,021
1861,73
06.05.1998
2543,827
2582,62
20.03.1998
1820,275
1919,91
07.05.1998
2554,239
2509,78
23.03.1998
1854,263
1950,75
08.05.1998
2563,418
2450,16
24.03.1998
1887,948
1922,86
11.05.1998
2571,351
2358,15
26.03.1998
1921,289
1992,81
12.05.1998
2578,028
2438,39
27.03.1998
1954,248
2063,32
13.05.1998
2583,437
2494,66
30.03.1998
1986,784
2083,89
14.05.1998
2587,571
2494,70
31.03.1998
2018,857
2005,80
15.05.1998
2590,423
2469,84
01.04.1998
2050,429
1988,78
18.05.1998
2591,99
2500,44
02.04.1998
2081,46
1995,00
19.05.1998
2592,269
2493,70
03.04.1998
2111,91
2063,50
20.05.1998
2591,259
2547,01
06.04.1998
2141,741
2135,31
21.05.1998
2588,963
2573,98
07.04.1998
2170,914
2129,08
22.05.1998
2585,383
2606,48
08.04.1998
2199,391
2124,76
25.05.1998
2580,525
2669,76
09.04.1998
2227,134
2157,39
26.05.1998
2574,396
2621,33
10.04.1998
2254,106
2158,12
27.05.1998
2567,005
2523,03
13.04.1998
2280,27
2255,81
28.05.1998
2558,364
2549,07
14.04.1998
2305,593
2266,35
29.05.1998
2548,484
2591,03
15.04.1998
2330,037
2339,28
01.06.1998
2537,381
2536,09
16.04.1998
2353,571
2448,55
02.06.1998
2525,071
2551,47
21.04.1998
2376,161
2627,90
03.06.1998
2511,571
2581,24
22.04.1998
2397,776
2623,39
04.06.1998
2496,903
2567,21
23.04.1998
2418,384
2618,65
05.06.1998
2481,086
2562,82

References
[Azariadis C.] Intertemporal Macroeconomics  Blacwell  1993
[BLACK f.sCHOLES m.]  The pricing of Options and Corporate Liabilities  Journal of Economic Theory 10 pp 239-257
[BREIMAN L.].(1961) Optimal gambling Systems for Favorable Games Proc.Fourth Berkeley Sympos. on Mathematics Statistics and Probability ,University of California Press ,Berkeley 1,pp65-78.
[BROER D.P.-JANSEN W.J.](1998) Dynamic Portfolio Adjustment and Capital Controls: An Euler Equation Approach Southern Economic Journal 64(4) pp 902-921.
[Constantinides G.M.] (1979) Multiperiod consumption and investment behavior with convex transaction costs Management Science Vol. 25 No 11 Nov.,pp1127-1137
[DAVIS M.H.-NORMAN A.R.] (1990) Portfolio Selection with transaction costs Mathematics of Operations Research Vol. 15 No 4 PP 676-713
[DIMOPOULOS  D (1998)] . Technical analysis ,Eurocapital  Pubications
[DUFFIE D.-SUN T.](1990)  Transaction costs and portfolio choice in a discrete-continuous time setting Journal of Economic Dynamics and Control 14 pp. 35-51.
[DUMAS B.-LUCIANO EL.](1991) An exact Solution to a Dynamic Portfolio Choice Problem under Transaction Costs.The Journal of Finance Vol. XLVI No2 pp 577-595.
[ELLIOT,R.N.] (1980) The major works of R.N. Elliot ,Chappaqua (edited by Robert Prechter) NY:New Classics Library .
[ELTON E.J.-GRUBER M.J.] (1991) Modern portfolio theory and investment analysis Wiley.
[FROST ,A.J.-PRECHTER R.R.](1978) Elliot Wave Principle key to stock market profits. Chappaqua  NY:New Classics Library .
[GENCAY R.](1998) Optimization of technical trading strategies and the profitability in security markets. Economic Letters 59 pp249-254.
[Hair-Anderson-Tatham-Black] Maltivariate Analysis  5th edition Prentice Hall 1998
[Hamilton J.D.]  Time Series Analysis ,Princeton University Press 1994
[Kloeden E.P.-Platen E.-Schurtz H.] Numerical Solutions of SDE Through Computer Experiments  Springer 1997
[Karlin S-taylor H.M.] A first course in stochastic processes. Academic press 1975
[Lambert H.Koopmans] The Spectral Analysis of time series Academic Press
Probability and mathematical Statistics Vol 22 1995
[Lutkepohl H.] Introduction to Multiple Time Series Analysis Springer 1993
[Magee J.] Technical Analysis of Stock Trends New York Institute of Finance 1992
[Mallaris A.G.-Brock W.A.] Stochastic Methods in Economics and Finance North-Holland 1982
[MAynard S.J.] Models in Ecology                      Cambridge University Press 1979
[MERTZANIS CH.] Limit of prices and variance of the general index in the Athens Stocmarket Proceedings of the Conference of the Institute of Statistics 1998
[MILLIONIS A.E..-MOSCHOS D.] Information Efficiency and application in the Athens Stockmarket. Proceedings of the Conference of the Institute of Statistics 1998
[Mood A.-Graybaill A.F.-Boes D.C.] Introduction to the theory of Statistics McGraw-Hill 1974
[Murphy J.J.] Technical Analysis of the Futures Markets .New York Institute of Finance
[Nicholis D.F.-Quinn B.G.] Random coefficients autoregressive models:an introduction .Lecture Notes in Statistics No 11 Springer NY.   
[Oksendal B.] Stochastic Differential equations Springer 1995
[PAPADAMOY S.-PAPANASTASIOU D.-TSOPOGLOU] Research on the predictability of the stocks in the Athens Stockmarket. [ScarthM.W.] Macroeconomics  Hancourt Brace &Company Canada 1996
[SPANOUDAKI I.-KAMPANELOY A.-ANTONOGIORKAKIS P.] Volume indices in the technical analysis of stocks.Monte-carlo empirical results. Proceedings of the Conference of the Institute of Statistics 1998
[Tong H.] Non-Linear Time series :A dynamic System Approach Clarendon Press Oxford 1990