【神經(jīng)網(wǎng)絡(luò)異常檢測】A Test for the Presence of Jumps in Financial Markets using Neural Networks in R

A Test for the Presence of Jumps in Financial Markets using Neural Networks in R

Wall Street Bull

Modelling of financial markets is usually undertaken using stochastic processes. Stochastic processes are collection of random variables indexed, for our purposes, by time. Examples of stochastic processes used in finance includeGBM,OU,Heston Model andJump Diffusion processes.? For a more mathematically detailed explanation of stochastic processes, diffusion and jump diffusion models, readthisarticle. To get an intuitive feeling of how these different stochastic processes behave, visit the interactiveweb applicationthat I worked on in conjunction withTuring FinanceandSouthern Ark.

As was witnessed during the recent financial crisis, stock markets exhibit jumps. That is, they exhibit large falls in value.?Over the past couple of decades, the?has?been increasing interest in the modelling of these jumps. The classic model for modelling jumps in stochastic processes is theMerton Jump diffusionmodel.? This model says that the returns from an asset are driven by “normal” price vibrations (representing the continuous diffusion component) and “abnormal” price vibrations (representing the discontinuous jump component).? The SDE of the Merton Jump diffusion model ?is given as:

In practice, before we can proceed with fitting a?jump diffusion model to data, we first have to establish if the data that we are fitting the model to has jumps. This requires us to statistically test for the presence of jumps in return data.

There are various tests that have been developed for testing for jumps in return data. Examples of ?such tests include the bi-power variations test of Barndorff-Nielsen and Shepard (2006). This jump test compares the estimate of variance that is not robust to the presence of jumps, called realized variance, with an estimate of variance that is robust to the presence of jumps, called bi-power variation. This test was improved by?Ait Sahalia and Jacod (2009). In their test, they compare?the bi-power variations for returns sampled at different frequencies.?Lee and Mykland (2008)?also used insights from the test of?Barndorff-Nielsen and Shepard (2006) by testing?for the presence of jumps at each observed value of the process, while taking into account the volatility of the process at the time the observation was made. The test of Lee and Mykland (2008) has the added advantage that it not only indicates whether or not jumps have occurred, but also gives information as to what time the jumps occurred and their size.

In this blog post, I propose a test for the presence of jumps using?Neural Networks. This test is then assessed using simulation compared to the Lee and Mykland (2008) test, then we look at how the Neural Network test?fares on stocks on the JSE.

The Neural Network Test

An example of biological neural networks

Neural Networks are a group of learning models which fall under?machine learning. They were inspired by the biological neural networks. ?For a detailed analysis of neural networks and the algorithm used to train neural networks, please refer to?this?article by Turing Finance.

As mentioned above, the test I am??proposing uses neural networks to test for jumps. This test establishes?whether or not the whole series of returns has jumps. That is, the test has a binary outcome. This means that we can treat the testing for the presence of jumps as a classification problem. We want to classify a set of returns as belonging to on one of two categories, having jumps or not having jumps.

Given that neural networks can perform well in classification problems, such as in?credit rating, it seems natural to try see how neural networks perform when trained to distinguish between a set of returns that has jumps and one that does not have jumps.

Architecture of Neural Network

As the test uses neural networks, we need to carefully think about the architecture of the neural network. That is, we need to think of: what the inputs to the network are, what number of hidden layers (and associated number of neurons) we should have, and what the output layer should look like.

I have chosen the inputs into the neural network are: The first and second centered moments, skewness, kurtosis, the fifth, sixth, seventh and eighth centered moments. All of the moments used are sample moments. These particular variables were chosen as inputs to the neural network as the tests of Barndorff-Nielsen and Shepard (2006), Ait Sahalia and Jacod (2009) and Lee and Mykland (2008) use versions of these moments as their test statistics. So we believe that these moments should have strong predictive power.However, it should be noted that the moments are not necessarily independent and this could affect the performance of the neural network. Thus the inputs into the?neural?network?still need further work.?Let?

?be a series of?
?log returns. The moments inputs would then be given as:

It is important note that this particular architecture was chosen just for illustrating how one would think about testing for jumps using neural networks. It is by no means necessarily the “best’ architecture. This is definitely an area for future work. We hope to cover this in later posts.

Having decided on the architecture of the neural network, we still needed to ?train it. The neural network was trained on 3000 observations from a processes that has jumps (generated using the Merton Jump model) and a process which does not have jumps (generated using GBM). ?The neural network was trained using the neuralnet package in R.

Simulation study

Simulations were undertaken to assess how the neural network test performs against the Lee & Mykland Test (2008).? The underlying model being assumed is the basic Merton model discussed above. ??Using simulations, we worked out the Probability of?ACTUAL?detection (the test being able to detect jumps in ?a series that has jumps) and the probability?of?FALSE?detection (the test incorrectly detecting jumps in a series of returns that doesn't have jumps) of each of the tests. The simulation was conducted at a daily frequency, using different combinations of the parameters.?A more rigorous comparison would have to compare the two tests?at different frequencies, and for large and small jumps.

We have summarized the results of the simulations conducted in the table below:

Based on the simulation results in the table above, the neural?network test to perform better than the Lee & Mykland (2008) test. This is because the probability of actual detection for the neural?network?test is higher than for the Lee & Mykland (2008) test, and the probability of false detection is lower than that of the Lee & Mykland (2008) test.

Given that we have seen how the test performs on simulated data, we are now in a position to apply the test on data from the Johannesburg Stock Exchange.

Applying the Test to JSE Data

The Johannesburg Stock Exchange (JSE) building in Sandton. It has operated as a market place for the trading of financial products for nearly 125 years.

After seeing how the neural network test for jumps performs in simulations, we applied the test to 217?stocks which are listed?on the?Johannesburg Stock Exchange (JSE). The various stocks used in this post, categorized by industry, are shown in the table below.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 228,983評論 6 537
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 98,772評論 3 422
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 176,947評論 0 381
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經(jīng)常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,201評論 1 315
  • 正文 為了忘掉前任,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當(dāng)我...
    茶點故事閱讀 71,960評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 55,350評論 1 324
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,406評論 3 444
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 42,549評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 49,104評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 40,914評論 3 356
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,089評論 1 371
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,647評論 5 362
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 44,340評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,753評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,007評論 1 289
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,834評論 3 395
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 48,106評論 2 375

推薦閱讀更多精彩內(nèi)容

  • 十年光陰,何處安尋。只是在夢里,偶爾憶起。樸素為衣,素箋寫不盡。貧弱的幾筆,是我在想您。十年,十年,我想告訴您。 ...
    白箋閱讀 145評論 0 5
  • 各種無人理會,這種感覺夠差,夠壞。 心里有話卻無人可以訴說。 只有親人靠譜。 早些睡吧,自我拋棄的人。
    肉頭鬼閱讀 300評論 0 0
  • 美人卷珠簾, 深坐蹙蛾眉。 但見淚痕濕, 不知心恨誰。
    5562d88ec370閱讀 310評論 0 0
  • 若問情為何物,誰也說不太清楚。人類對自然、人文、社會、科技的研究可謂情有獨鐘,滿世界都有這些研究機構(gòu),唯獨沒有情為...
    熊玲心理咨詢閱讀 545評論 0 1
  • C和他在心理診所相遇,C的抑郁癥癥狀有所緩解,只是來做定期檢查。兩人一起坐在診室外面的椅子上,因為無聊而交談起來。...
    Sharine火火閱讀 225評論 0 1