Log in

Optimal Stock Portfolio Selection with a Multivariate Hidden Markov Model

  • Published:
Sankhya B Aims and scope Submit manuscript

Abstract

The underlying market trends that drive stock price fluctuations are often referred to in terms of bull and bear markets. Optimal stock portfolio selection methods need to take into account these market trends; however, the bull and bear market states tend to be unobserved and can only be assigned retrospectively. We fit a linked hidden Markov model (LHMM) to relative stock price changes for S&P 500 stocks from 2011–2016 based on weekly closing values. The LHMM consists of a multivariate state process whose individual components correspond to HMMs for each of the 12 sectors of the S&P 500 stocks. The state processes are linked using a Gaussian copula so that the states of the component chains are correlated at any given time point. The LHMM allows us to capture more heterogeneity in the underlying market dynamics for each sector. In this study, stock performances are evaluated in terms of capital gains using the LHMM by utilizing historical stock price data. Based on the fitted LHMM, optimal stock portfolios are constructed to maximize capital gain while balancing reward and risk. Under out-of-sample testing, the annual capital gain for the portfolios for 2016–2017 are calculated. Portfolios constructed using the LHMM are able to generate returns comparable to the S&P 500 index.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Figure 1
Figure 2

Similar content being viewed by others

References

  • Baum, L.E. and Petrie, T. (1966). Statistical inference for probabilistic functions of finite state Markov chains. Ann. Math. Stat. 37, 1554–1563.

    Article  MathSciNet  MATH  Google Scholar 

  • Brechmann, E.C., Czado, C. and Aas, K. (2012). Truncated regular vines in high dimensions with application to financial data. Cana. J. Stat. 40, 68–85.

    Article  MathSciNet  MATH  Google Scholar 

  • Dempster, A.P., Laird, N.M. and Rubin, D.B. (1977). Maximum likelihood from incomplete data via the EM algorithm. J. R. Stat. Soc., 39.

  • Elliott, R. and van der Hoek, J. (1997). An application of hidden Markov models to asset allocation problems (*). Finance Stochast. 1, 229–238. https://doi.org/10.1007/s007800050022.

    Article  MATH  Google Scholar 

  • Elliott, R., Siu, T.K. and Alex, B. (2010). On mean-variance portfolio selection under a hidden Markovian regime-switching model. Econ. Model.27, 678–686.

    Article  Google Scholar 

  • Ensor, K.B. and Koev, G.M. (2014). Computational finance: Correlation, volatility, and markets. WIREs Comput. Stat. 6, 326–340. https://doi.org/10.1002/wics.1323.

    Article  Google Scholar 

  • Fiecas, M., Franke, J., von Sachs, R. et al. (2017). Shrinkage estimation for multivariate hidden Markov models. J. Am. Stat. Assoc. 112, 326–340. https://doi.org/10.1080/01621459.2016.1148608.

    Article  MathSciNet  Google Scholar 

  • Hamilton, J.D. (1989). A new approach to the economic analysis of nonstationary time series and the business cycle. Econometrica 57, 357–384.

    Article  MathSciNet  MATH  Google Scholar 

  • Hassan, M.R. and Nath, B. (2005). Stock market forecasting using hidden Markov model: A new approach, p. 192–96.

  • Ji, Q. (2019). Computational methods for hidden Markov models with applications. Ph.D. Thesis Department of Mathematics and Statistics. University of Maryland, Baltimore County.

    Google Scholar 

  • Ji, Q. and Neerchal, N.K. (2019). Creating stock portfolios using hidden Markov models, p. 2105–2118.

  • Joe, H. and Xu, J.J. (1996). The Estimation Method of Inference Functions for Margins for Multivariate Models. Tech. Rep. No. 166 Department of Statistics. University of British Columbia, Vancouver.

    Google Scholar 

  • Kole, E. and Dijk, v D (2016). How to identify and forecast bull and bear markets? J. Appl. Econ., 32.

  • Kruskal, W.H. (1958). Ordinal measures of association. J. Am. Stat. Assoc. 53, 814–861.

    Article  MathSciNet  MATH  Google Scholar 

  • Majumder, R. (2021). Hidden Markov Models for High Dimensional Data with Geostatistical Applications. Ph.D. Thesis Department of Mathematics and Statistics. University of Maryland, Baltimore County.

    Google Scholar 

  • Malkiel, BG (2019). A Random Walk Down Wall Street: Including A Life-Cycle Guide To Personal Investing, 12th edn. W.W. Norton & Company.

  • Markowitz, H. (1952). Portfolio selection. J. Financ. 7, 77–91.

    Google Scholar 

  • McGrory, C.A. and Titterington, D.M. (2009). Variational Bayesian analysis for hidden Markov models. Australian and New Zealand J. Stat. 51, 227–244.

    Article  MathSciNet  MATH  Google Scholar 

  • Mhanna, M. and Bauwens, W. (2012). A stochastic space-time model for the generation of daily rainfall in the Gaza Strip. Int. J. Climatol. 32, 1098–1112.

    Article  Google Scholar 

  • Nelsen, RB (2006). An Introduction to Copulas, 2nd edn. Springer.

  • Nguyen, N. (2018). Hidden Markov model for stock trading. Int. J. Financ. Stud. 36, 192–96.

    Google Scholar 

  • Nguyen, N. and Nguyen, D. (2015). Hidden Markov model for stock selection. Risks 3, 455–473.

    Article  Google Scholar 

  • Rabiner, L.R. (1989). A tutorial on hidden Markov models and selected applications in speech recognition. Proc. IEEE, 77.

  • Rizzo, ML (2019). Statistical Computing with R, 2nd edn. Chapman & Hall/CRC.

  • Serfozo, R (2009). Basics of Applied Stochastic Processes. Springer.

  • Varin, C., Reid, N. and Firth, D. (2011). An overview of composite likelihood methods. Stat. Sin. 21, 5–42.

    MathSciNet  MATH  Google Scholar 

  • Visser, I and Speekenbrink, M (2010). depmixS4: An R package for hidden Markov models. J. Stat. Softw. 36, 7, 1–21. http://www.jstatsoft.org/v36/i07/.

    Article  Google Scholar 

  • Visser, I and Speekenbrink, M (2019). Hidden Markov Models with R. Springer.

  • Viterbi, A. (1967). Error bounds for convolutional codes and an asymptotically optimum decoding algorithm. IEEE Trans. Inf. Theory 13, 260–269.

    Article  MATH  Google Scholar 

  • Xu, J and Cao, L (2021). High-dimensional cross-market dependence modeling and portfolio forecasting by copula variational LSTM. Available at SSRN: https://doi.org/10.2139/ssrn.3881474.

  • Yeo, I.K. and Johnson, R.A. (2000). A new family of power transformations to improve normality or symmetry. Biometrika 87, 954–959.

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgements

The hardware used in the computational studies is part of the UMBC High Performance Computing Facility (HPCF). The facility is supported by the U.S. National Science Foundation through the MRI program (grant nos. CNS–0821258, CNS–1228778, and OAC–1726023) and the SCREMS program (grant no. DMS–0821311), with additional substantial support from the University of Maryland, Baltimore County (UMBC). See hpcf.umbc.edu for more information on HPCF and the projects using its resources. Reetam Majumder was supported by the Joint Center for Earth Systems Technology and by the HPCF as a Research Assistant.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Reetam Majumder.

Ethics declarations

Conflict of Interest

The authors have no competing interests to declare that are relevant to the content of this article.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Qing Ji and Nagaraj K. Neerchal contributed equally to this work.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Majumder, R., Ji, Q. & Neerchal, N.K. Optimal Stock Portfolio Selection with a Multivariate Hidden Markov Model. Sankhya B 85 (Suppl 1), 177–198 (2023). https://doi.org/10.1007/s13571-022-00290-5

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s13571-022-00290-5

Keywords and phrases

AMS (2000) subject classification

Navigation