Movatterモバイル変換


[0]ホーム

URL:


Introduction

Welcome to{fHMM}, an R package for modeling financialtime series data with hidden Markov models (HMMs). This introductionmotivates the approach, gives anoverview of the packagefunctionality and the included vignettes, andplaces the approach in the existingliterature.

Motivation

Earning money with stock trading is simple: one “only” needs to buyand sell stocks at the right moment. In general, stock traders seek toinvest at the beginning of upward trends (hereon termed as bullishmarkets) and repel their stocks just in time before the prices fallagain (hereon termed as bearish markets). As stock prices depend on avariety of environmental factors(Humpe and Macmillan 2009;Cohen, Diether, and Malloy 2013), chancecertainly plays a fundamental role in hitting those exact moments.However, investigating market behavior can lead to a betterunderstanding of how trends alternate and thereby increases the chanceof making profitable investment decisions.

The{fHMM} package aims at contributing to thoseinvestigations by applying HMMs to detect bearish and bullish markets infinancial time series. It also implements the hierarchical modelextension presented inOelschläger and Adam (2021), which improves the model’scapability for distinguishing between short- and long-term trends andallows to interpret market dynamics at multiple time scales.

Package and vignettes overview

The functionality of the{fHMM} package can beclassified into functions for data preparation, model estimation, andmodel evaluation. The following flowchart visualizes theirdependencies:

A flowchart of the {fHMM} package: Functions are boxed and classes displayed as circles.
A flowchart of the {fHMM} package: Functions areboxed and classes displayed as circles.

The tasksdata preparation,model estimation, andmodel evaluation as well as their corresponding functions andclasses are explained in detail in separate vignettes:

Placement in the literature

Over the last decades, various HMM-type models have emerged aspopular tools for modeling financial time series that are subject tostate-switching over time(Schaller and Van Norden 1997;Dias, Vermunt, and Ramos 2010;Ang and Timmermann 2012;DeAngelis and Viroli 2017).Rydén,Teräsvirta, and Åsbrink (1998),Bulla and Bulla (2006),andNystrup, Madsen, and Lindström (2015), e.g., used HMMs to derive stylizedfacts of stock returns, whileHassan and Nath (2005) andNystrup,Madsen, and Lindström (2017)demonstrated that HMMs can prove useful for economic forecasting. Morerecently,Lihn (2017) applied HMMs to the Standard andPoor’s 500, where HMMs were used to identify different levels of marketvolatility, aiming at providing evidence for the conjecture that returnsexhibit negative correlation with volatility. Another application to theS&P 500 can be found inNguyen (2018), where HMMs were used to predictmonthly closing prices to derive an optimal trading strategy, which wasshown to outperform the conventional buy-and-hold strategy. Furtherapplications, which involve HMM-type models for asset allocation andportfolio optimization, can be found inBekaertand Ang (2002),Bulla et al. (2011),Nystrup, Madsen, and Lindström (2015) andNystrup,Madsen, and Lindström (2018), to namebut a few examples. All these applications demonstrate that HMMsconstitute a versatile class of time series models that naturallyaccounts for the dynamics typically exhibited by financial timeseries.

References

Ang, A., and A. Timmermann. 2012.“Regime Changes and FinancialMarkets.”Annual Review of Financial Economics 4 (1):313–37.https://doi.org/10.1146/annurev-financial-110311-101808.
Bekaert, G., and A. Ang. 2002.“International Asset Allocationwith Regime Shifts.”Review of Financial Studies 15(February): 1137–87.https://doi.org/10.1093/rfs/15.4.1137.
Bulla, J., and I. Bulla. 2006.“Stylized Facts of Financial TimeSeries and Hidden Semi-Markov Models.”ComputationalStatistics and Data Analysis 51 (4): 2192–2209.https://doi.org/10.1016/j.csda.2006.07.021.
Bulla, J., S. Mergner, I. Bulla, A. Sesboüé, and C. Chesneau. 2011.“Markov-Switching Asset Allocation: Do Profitable StrategiesExist?”Journal of Asset Management 12 (July): 310–21.https://doi.org/10.1057/jam.2010.27.
Cohen, L., K. Diether, and C. Malloy. 2013.“Legislating StockPrices.”Journal of Financial Economics 110 (3): 574–95.
De Angelis, L., and C. Viroli. 2017.“A Markov-SwitchingRegression Model with Non-Gaussian Innovations: Estimation andTesting.”Studies in Nonlinear Dynamics &Econometrics 21 (2).https://doi.org/doi:10.1515/snde-2015-0118.
Dias, J., J. Vermunt, and S. Ramos. 2010.“Mixture Hidden MarkovModels in Finance Research.”Psycho-Oncology -PSYCHO-ONCOL, January, 451–59.https://doi.org/10.1007/978-3-642-01044-6_41.
Hassan, Md, and Baikunth Nath. 2005.“Stock Market ForecastingUsing Hidden Markov Model: A New Approach.”5th InternationalConference on Intelligent Systems Design and Applications 2005(October): 192–96.https://doi.org/10.1109/ISDA.2005.85.
Humpe, Andreas, and Peter Macmillan. 2009.“Can MacroeconomicVariables Explain Long-Term Stock Market Movements? A Comparison of theUS and Japan.”Applied Financial Economics 19 (2):111–19.https://doi.org/10.1080/09603100701748956.
Lihn, S. H. 2017.“Hidden Markov Model for Financial Time Seriesand Its Application to s&p 500 Index.”QuantitativeFinance (Forthcoming).
Nguyen, N. 2018.“Hidden Markov Model for Stock Trading.”International Journal of Financial Studies 6 (2).
Nystrup, P., H. Madsen, and E. Lindström. 2015.“Stylised Facts ofFinancial Time Series and Hidden Markov Models in ContinuousTime.”Quantitative Finance 15 (9): 1531–41.https://doi.org/10.1080/14697688.2015.1004801.
———. 2017.“Long Memory of Financial Time Series and Hidden MarkovModels with Time-Varying Parameters.”Journal ofForecasting 36 (8): 989–1002.
———. 2018.“Dynamic Portfolio Optimization Across Hidden MarketRegimes.”Quantitative Finance 18 (1): 83–95.https://doi.org/10.1080/14697688.2017.1342857.
Oelschläger, L., and T. Adam. 2021.“Detecting Bearish and BullishMarkets in Financial Time Series Using Hierarchical Hidden MarkovModels.”Statistical Modelling.https://doi.org/10.1177/1471082X211034048.
Rydén, T., T. Teräsvirta, and S. Åsbrink. 1998.“Stylized Facts ofDaily Return Series and the Hidden Markov Model.”Journal ofApplied Econometrics 13 (3): 217–44.
Schaller, H., and S. Van Norden. 1997.“Regime Switching in StockMarket Returns.”Applied Financial Economics 7 (2):177–91.https://doi.org/10.1080/096031097333745.

[8]ページ先頭

©2009-2025 Movatter.jp