Predicting Market Data Using The Kalman Filter

Similar documents
SCHOOL OF ACCOUNTING AND BUSINESS BSc. (APPLIED ACCOUNTING) GENERAL / SPECIAL DEGREE PROGRAMME

AY Term 2 Mock Examination

CAPITAL ASSET PRICING MODEL

1 Random Variables and Key Statistics

We learned: $100 cash today is preferred over $100 a year from now


Models of Asset Pricing

Models of Asset Pricing

Models of Asset Pricing

Dr. Maddah ENMG 624 Financial Eng g I 03/22/06. Chapter 6 Mean-Variance Portfolio Theory

Appendix 1 to Chapter 5

of Asset Pricing R e = expected return

of Asset Pricing APPENDIX 1 TO CHAPTER EXPECTED RETURN APPLICATION Expected Return

Estimating Proportions with Confidence

International Journal of Management (IJM), ISSN (Print), ISSN (Online) Volume 1, Number 2, July - Aug (2010), IAEME

Sampling Distributions and Estimation

CHAPTER 2 PRICING OF BONDS

Anomaly Correction by Optimal Trading Frequency

Monetary Economics: Problem Set #5 Solutions

CHAPTER 3 RESEARCH METHODOLOGY. Chaigusin (2011) mentioned that stock markets have different

Proceedings of the 5th WSEAS Int. Conf. on SIMULATION, MODELING AND OPTIMIZATION, Corfu, Greece, August 17-19, 2005 (pp )

Online appendices from Counterparty Risk and Credit Value Adjustment a continuing challenge for global financial markets by Jon Gregory

FOR TEACHERS ONLY. The University of the State of New York REGENTS HIGH SCHOOL EXAMINATION PHYSICAL SETTING/PHYSICS


Forecasting bad debt losses using clustering algorithms and Markov chains

A point estimate is the value of a statistic that estimates the value of a parameter.

A New Approach to Obtain an Optimal Solution for the Assignment Problem

A random variable is a variable whose value is a numerical outcome of a random phenomenon.

Confidence Intervals. CI for a population mean (σ is known and n > 30 or the variable is normally distributed in the.

Math 124: Lecture for Week 10 of 17

When you click on Unit V in your course, you will see a TO DO LIST to assist you in starting your course.

CAPITAL PROJECT SCREENING AND SELECTION

physicsandmathstutor.com

Class Sessions 2, 3, and 4: The Time Value of Money

Chapter Six. Bond Prices 1/15/2018. Chapter 4, Part 2 Bonds, Bond Prices, Interest Rates and Holding Period Return.

ii. Interval estimation:

Topic-7. Large Sample Estimation

MODIFICATION OF HOLT S MODEL EXEMPLIFIED BY THE TRANSPORT OF GOODS BY INLAND WATERWAYS TRANSPORT

Lecture 4: Parameter Estimation and Confidence Intervals. GENOME 560 Doug Fowler, GS

Unbiased estimators Estimators

5. Best Unbiased Estimators

A Technical Description of the STARS Efficiency Rating System Calculation

An Empirical Study of the Behaviour of the Sample Kurtosis in Samples from Symmetric Stable Distributions

Standard Deviations for Normal Sampling Distributions are: For proportions For means _

STRAND: FINANCE. Unit 3 Loans and Mortgages TEXT. Contents. Section. 3.1 Annual Percentage Rate (APR) 3.2 APR for Repayment of Loans

Statistical techniques

The Time Value of Money in Financial Management

ad covexity Defie Macaulay duratio D Mod = r 1 = ( CF i i k (1 + r k) i ) (1.) (1 + r k) C = ( r ) = 1 ( CF i i(i + 1) (1 + r k) i+ k ) ( ( i k ) CF i

REINSURANCE ALLOCATING RISK

Limits of sequences. Contents 1. Introduction 2 2. Some notation for sequences The behaviour of infinite sequences 3

Confidence Intervals Introduction

Problem Set 1a - Oligopoly

r i = a i + b i f b i = Cov[r i, f] The only parameters to be estimated for this model are a i 's, b i 's, σe 2 i

Today: Finish Chapter 9 (Sections 9.6 to 9.8 and 9.9 Lesson 3)

CHAPTER 8 Estimating with Confidence

DESCRIPTION OF MATHEMATICAL MODELS USED IN RATING ACTIVITIES

This article is part of a series providing

. (The calculated sample mean is symbolized by x.)

Overlapping Generations

An Improved Composite Forecast For Realized Volatility

Lecture 4: Probability (continued)

CreditRisk + Download document from CSFB web site:

Binomial Model. Stock Price Dynamics. The Key Idea Riskless Hedge

Subject CT1 Financial Mathematics Core Technical Syllabus

Basic formula for confidence intervals. Formulas for estimating population variance Normal Uniform Proportion

= α e ; x 0. Such a random variable is said to have an exponential distribution, with parameter α. [Here, view X as time-to-failure.

0.07. i PV Qa Q Q i n. Chapter 3, Section 2

THE ACCURACY OF UNEMPLOYMENT RATE FORECASTS IN ROMANIA AND THE ACTUAL ECONOMIC CRISIS

Inferential Statistics and Probability a Holistic Approach. Inference Process. Inference Process. Chapter 8 Slides. Maurice Geraghty,

1 + r. k=1. (1 + r) k = A r 1

EXERCISE - BINOMIAL THEOREM

Faculdade de Economia da Universidade de Coimbra

point estimator a random variable (like P or X) whose values are used to estimate a population parameter

SUPPLEMENTAL MATERIAL

Chapter 8: Estimation of Mean & Proportion. Introduction

Section 3.3 Exercises Part A Simplify the following. 1. (3m 2 ) 5 2. x 7 x 11

Department of Mathematics, S.R.K.R. Engineering College, Bhimavaram, A.P., India 2

MA Lesson 11 Section 1.3. Solving Applied Problems with Linear Equations of one Variable

Mine Closure Risk Assessment A living process during the operation

ST 305: Exam 2 Fall 2014

Calculation of the Annual Equivalent Rate (AER)

Portfolio Optimization

Statistics for Economics & Business

0.1 Valuation Formula:

ACTUARIAL RESEARCH CLEARING HOUSE 1990 VOL. 2 INTEREST, AMORTIZATION AND SIMPLICITY. by Thomas M. Zavist, A.S.A.

Just Lucky? A Statistical Test for Option Backdating

RISK DIVERSIFICATION BETWEEN STOCK MARKETS IN GERMANY AND BOSNIA AND HERZEGOVINA

18.S096 Problem Set 5 Fall 2013 Volatility Modeling Due Date: 10/29/2013

T4032-BC, Payroll Deductions Tables CPP, EI, and income tax deductions British Columbia Effective January 1, 2016

Chapter 5: Sequences and Series

BASIC STATISTICS ECOE 1323

MATH : EXAM 2 REVIEW. A = P 1 + AP R ) ny

Correlation possibly the most important and least understood topic in finance

B = A x z

SIMPLE INTEREST, COMPOUND INTEREST INCLUDING ANNUITY

Optimizing of the Investment Structure of the Telecommunication Sector Company

Outline. Plotting discrete-time signals. Sampling Process. Discrete-Time Signal Representations Important D-T Signals Digital Signals

Control Charts for Mean under Shrinkage Technique

Chapter 3. Compound interest

Course FM Practice Exam 1 Solutions

Transcription:

Stocks & Commodities V. : (-5): Predictig Market Data Usig The Kalma Filter, Pt by R. Martielli & N. Rhoads The Future Ad The Filter Predictig Market Data Usig The Kalma Filter Ca the Kalma filter be used to predict future price movemet? I this secod part of this series we aswer this questio. P by Rick Martielli ad Neil Rhoads reviously, we discussed the Kalma filter ad the alpha idicator. This time, we study the accumulatio of profit/loss through the fortue chart. We also backtest the filter ad aalyze the results. The profit/loss o day k may be writte as Part P k = A W k (y k /y k- ) where the quatity i paretheses is the relative price-chage, or retur, o day k, A is the trade amout i dollars, ad W k = if α k > C, W k = - if α k < -C ad W k = zero otherwise (W for wager). Note that W k = correspods to o trade o day k ad so P k = zero as well. Further, ote that A is the same for every trade. For the Ford data, C was foud to be.3, ad Figure shows its P k values, where the trade amout A was set to $. (zero values are ot show). The red poit at November,, represets the trade havig the largest KEN SMITH

MICROSOFT EXCEL Stocks & Commodities V. : (-5): Predictig Market Data Usig The Kalma Filter, Pt by R. Martielli & N. Rhoads Profit/Loss.5..3.. -. -. -.3 -. -.5 7/3/ /3/ /3/9 /3/9 Figure : profit/loss. Here you see the P k values for the Ford data from Figure i Part : T =., C =.3, A =. The red poit at // represets the trade havig the largest profit. profit. The reaso for the large profit ca be see i Figure, Part, where the red poit i Figure correspods to poit i Figure. The predictio of. was owhere ear the actual at.7, but it was i the correct directio, up from.7, resultig i a.3 profit. The fortue sequece is the accumulatio of the P k s:. 3.5 3..5..5..5. Data ad Predictios 3 5 7 9 3 5 Figure : data ad predictios. Here you see the Kalma predictios for a portio of the data from // /9/9 (gree) together with the data. The red poit i Figure correspods to poit i Figure, Part. the scheme was able to capture every price chage i the data that is, correctly predict directio each tradig day. Assumig A=, the sum S = y / y k k k = F = P k = Its last value, F N, is called the last-day fortue (Ldf) ad represets the amout of profit/loss realized at the ed of the simulatio. A graph of F versus day, correspodig to the P k data i Figure, is show i Figure 3. The Ldf is.37 o trades, or about.% average profit per trade. This is, of course, a idealized fortue i which there are o trade commissios, ad trades ca be trasacted at the prescribed buy/sell prices (o slippage). It is used here primarily to evaluate the Kalma filter s ability to predict the directio a stock price will take. The fortue plot is oe idicator of that ability, ad so is the profit ratio, defied as the ratio of umber of profitable trades to total trades. I the Ford simulatio that we discussed i Part, it was.59. The profit ratio ca be roughly visualized as the ratio of umber of poits above the zero lie to total poits. Efficiecy A third way to evaluate the filter is by its efficiecy. Suppose k of the absolute values of the returs represets the maximum amout of profit that ca be realized by day (usig this scheme) ad is called the available profit (AP) o day. The last value, S N, is the total AP i the data, ad the ratio F N /S N is take as the filter s efficiecy. For the Ford example, S N is 3.5 makig the efficiecy., or about %. Figure plots F, the evolutio of the fortue (gree lie) compared with S, the evolutio of the AP, providig a view of the filter s efficiecy over time. The available profit lie has a desirable property, called zero dowside volatility, which we would like to see i the fortue. Hece, we should choose the fortue lie that is earest the AP lie, where the distace D betwee the two lies is calculated as: = k k k = D (S F ) The value of C that miimizes D ca be take as optimal C, which is the method used with the Ford data. The other method, maximizig the Ldf, usually yields the same C.5.5 Fortue -.5 7/3/ /3/ /3/9 /3/9 FIGURE 3: FORTUNE CHART. Here you see the fortue chart for the Ford data i Figure, Part. It is a quadratic model where T =., C =.3, A =, LDF =.37. Fortue ad Available Profit - 7/3/ /3/ /3/9 /3/9 FIGURE : FORTUNE AND AVAILABLE PROFIT. Here you see a compariso of the fortue chart (gree) with the Available Profit (AP) lie for the Ford data.

Stocks & Commodities V. : (-5): Predictig Market Data Usig The Kalma Filter, Pt by R. Martielli & N. Rhoads Symbol Ed Date Last AP T Optimal LDF Efficiecy Profit # Trades Dollar Price C Ratio Retur MECA /3/. 39.5.7..9.9%.9. BUTL 7/3/9. 3.9 3.3. 5.9.%.35.77 3 CTIC //9.5 3.3 -... 5.%.39 7. ANPI 7//9. 7.59... 3.3%.5 9 33.55 5 BJCT 7/3/9. 7. 3.. 5..7%.35 3.7 BPUR 7//9. 5. 3.3..5 9.%.93 5.35 7 TKO 7/9/9. 3.7 3.5.3.53.9%.3 5.3 BBGI 7//9.3.3..3 3.7.%.59 7.3 9 CENX //9.....3.9%.3 3.39 RAE 7/9/9.75.3 3..3.3 9.%.55 3. MDH 7/9/9. 9.5.. 5.53.3%.555 3. ACAS 7/9/9 3.35 9.7...77 9.%.5 9 9.3 3 HEB 7/9/9.3. 3.9.3.59.%.. CLZR //9.3..9..79 9.%.7.9 5 NG 7/9/9 3.9....97.9%.53. GAN 7/9/9.. 3.3..5.%.5.93 7 PSTI //9.3 7....33 7.9%.5.39 BASI 7//9.5.97...9 5.%.7 7 3. 9 PAL 7/9/9.5.93.5..37 7.%.57 7. BCRX 7/3/9 3.....3.%.53.37 TIV 7/9/9.99.53...3 7.9%.9 7 5.9 BANR 7//9.93.3.9.3.5 9.3%.579 95. 3 ABG 7/9/9.99.7.7...9%. 3 3.99 FRG 7/9/9 3. 5.7.5..3.%.55.5 5 CNXT //9.35.... 5.%.55 3.7 BPFH 7/3/9. 3.9..7..9%.5 37 3.9 7 FAC //9. 3.7.5..3.%.5. BPOP 7/3/9. 3..5..9 3.9%.53 73.57 9 F 7/9/9 7. 3.5..3.37.%.59. 3 BELFA 7//9 3.39 3..9. 3.3 3.9%.5 5. 3 CACH //9.3.... 9.%.5 3. 3 PWR //9 5. 9.7...5.%.55.5 33 CMCO //9.3 9..5..9.%.539.95 3 CAKE //9 7.9 9...9.9 5.3%.55 33. 35 GE //9 3.3.3.7..77.%. 57.5 3 CALM //9.7 7.5...9.5%.53 7.7 FIGURE 5: RESULTS OF SIMULATION OF 3 LARGE AP STOCKS. The results for the Ford data are show. The last colum is the average profit/loss i dollars, or dollar retur, based o a trade amout of $,. value, but ot always. Give a choice, we take the largest C value because although the Ldf may be smaller, the fortue lie is smoother. Use that alpha sequece to fid the optimal cutoff C 5 Use the optimal cutoff C to calculate the fortue chart. Backtestig the filter The filter was tested o oe year of daily opes for a large group of selected stocks (all data obtaied from Yahoo Fiace). The simulatios ivolved two optimizatios: The first optimizatio determies the best Kalma trackig parameter ad the secod fids the best alpha cutoff. The simulatio proceeds i five steps: Track oe year of data multiple times to fid the optimal trackig parameter T Track the data oce more usig optimal T 3 Use the resultig Kalma predictios ad their stadard deviatios to fid the alpha sequece α k While we chose the Ford data more or less at radom, the items used i the simulatios were carefully selected to have the largest available profit. We scaed opeig prices for approximately 5, stocks for their oe-year available profit ad may of the stocks havig APs greater tha seve were tracked with the quadratic filter. Oe reaso for choosig opes is that they usually have the largest AP of the four daily prices. A represetative sample of the results is show i Figure 5 sorted by AP. We have icluded the results for the Ford data ad highlighted them. The last colum is the average profit/loss i dollars, or dollar retur, based o a trade amout A = $,. To get a better feel for the ature of these results, we plotted key features separately, startig with the sorted APs i Figure.

Stocks & Commodities V. : (-5): Predictig Market Data Usig The Kalma Filter, Pt by R. Martielli & N. Rhoads AP LDF 5 3 7 3 9 5 3 3 7 3 9 5 3 3 FIGURE : SORTED AVAILABLE PROFITS. Here you see the sorted APs for the 3 items i the table i Figure 5. FIGURE 7: LAST DAY FORTUNE. Here you see the LDFs correspodig to the AP s i Figure. % 5 3 Efficiecy 7 3 9 5 3 3..... Profit Ratio 7 3 9 5 3 3 FIGURE : FILTER EFFICIENCY. Here you see the filter efficiecies correspodig to the AP s i Figure. FIGURE 9: THE FILTER S PROFIT RATIO. Here you see the profit ratios for the 3 test items ad their average lie (red). Figures ad 7 show that filter efficiecy is essetially ucorrelated with AP (actual correlatio is.7). The obvious similarity betwee Figures 7 ad is artificial, because Ldf values are the product of AP ad efficiecy. The average Ldf is.±.9, a fairly wide rage, ad the average efficiecy is.%±9.5%, a slightly arrower rage tha the Ldfs, but both are still depedet o the data. Available profit is a property of the data oly ad is idepedet of the filter. Oly the filter s profit ratio (Figure 9) seems to be (early) idepedet of the data beig tracked; its average is.5±.7. The highest efficiecy is for o. i the table (Basi) at a icredible 5%, with a accompayig Ldf of.9. Data ad fortue for Basi are show i Figures A ad B. Basi has the highest optimal T at., implyig the quadratic model is well-suited to this data. Basi also has the smallest optimal C at., meaig every possible trade is executed. The least efficiet is Pwr at.% with a Ldf of.5, show i Figures A ad B. Its optimal T ad C values, AP, ad profit ratio values are all ear average, suggestig that somethig iheret i this data may be resposible for the filter s relatively poor performace. The stock havig the fewest trades ad best dollar retur is Heb at about $ per trade o trades, show i Figures A ad B. Its fortue chart differs from the others i that there are relatively log periods of time where o trades occur. This is due to the large optimal C value at.3, the largest i the table. Fortue results like Heb are attractive for their miimal dowward movemet. Tcic has the smallest trackig parameter at T =., meaig model oise is about double-data oise, suggestig aother model should be cosidered. Forecastig price movemets The goal here was to determie if a Kalma filter could be exploited to predict the directio of stock price movemets. Based o the Ldfs of the selected stocks i the table, the implemetatio described here is effective i some cases (for example, Basi). The filter s effectiveess is traced to two primary factors: the ature of the data amely, its available profit ad amout of correlatio ad the efficiecy of the filter, which is determied by the filter s model i combiatio with a particular dataset. Oly the profit ratio appears to be (early) idepedet of the data. Selectig oly the top performers from the table would lead to a highly profitable portfolio. Ufortuately, the simulatio preseted here could ever be implemeted i the real world because it requires all of the data o day to determie the optimal C ad T values resposible for the filter s performace. However, applicatio of this scheme to a shorter time period, say the previous quarter or two, should yield the best values for tomorrow s predictio. A simulatio of this scheme must wait for aother article. Rick Martielli ad Neil Rhoads are with Haiku Laboratories. They may be cotacted at ifo@haikulabs.com.

Stocks & Commodities V. : (-5): Predictig Market Data Usig The Kalma Filter, Pt by R. Martielli & N. Rhoads BASI. 5.. 3.... 7// // //9 //9 BASI - 7// // //9 //9 A FIGURE A ad B: DATA AND FORTUNE FOR BASI ENDING JULY, 9. BASI has the highest optimal T at., implyig the quadratic model is well-suited to this data. It also has the smallest optimal C at zero, meaig every possible trade is executed. The AP=7., LDF=.9, profit ratio.7, 7 trades, ad is about $3 per trade. B 3 PWR // 9// // 3//9 PWR.... -. // 9// // 3//9 A FIGURE A ad B: DATA AND FORTUNE FOR PWR ENDING JUNE, 9. The least efficiet is PWR, optimal T=., optimal C=., AP=9.7, LDF=.5, profit ratio.5, trades ad $.5 per trade. Its optimal T ad C values, AP ad profit ratio values are all ear average, suggestig somethig iheret i this data is resposible for the filter s relatively poor performace. B 5 HEB HEB 3.5.5 7/3/ /3/ /3/9 /3/9 7/3/ /3/ /3/9 /3/9 A B FIGURE A ad B: DATA AND FORTUNE FOR HEB ENDING 7/9/9. The stock havig the fewest trades ad best dollar retur is HEB at about $ per trade. Optimal T=3.9, optimal C=.3, AP=.9, LDF=.59, profit ratio., ad is trades ad $. per trade. Suggested readig Martielli, Rick, ad Neil Rhoads []. Predictig Market Data Usig The Kalma Filter, part, Techical Aalysis of Stocks & Commodities, Volume : Jauary. Martielli, Rick []. Haressig The (Mis)Behavior Of Markets, Techical Aalysis of Stocks & Commodities, Volume : Jue. []. Liear Estimatio Ad The Kalma Filter, www. haikulabs.com/liest.htm. S&C