IDEAS home Printed from
   My bibliography  Save this article

Hidden Markov Model for Stock Selection


  • Nguyet Nguyen

    () (Faculty of Mathematics and Statistics, Youngstown State University, 1 University Plaza, Youngstown, OH 44555, USA)

  • Dung Nguyen

    () (Quantitative Researcher, Ned Davis Research Group, 600 Bird Bay Drive West, Venice, FL 34285, USA)


The hidden Markov model (HMM) is typically used to predict the hidden regimes of observation data. Therefore, this model finds applications in many different areas, such as speech recognition systems, computational molecular biology and financial market predictions. In this paper, we use HMM for stock selection. We first use HMM to make monthly regime predictions for the four macroeconomic variables: inflation (consumer price index (CPI)), industrial production index (INDPRO), stock market index (S&P 500) and market volatility (VIX). At the end of each month, we calibrate HMM’s parameters for each of these economic variables and predict its regimes for the next month. We then look back into historical data to find the time periods for which the four variables had similar regimes with the forecasted regimes. Within those similar periods, we analyze all of the S&P 500 stocks to identify which stock characteristics have been well rewarded during the time periods and assign scores and corresponding weights for each of the stock characteristics. A composite score of each stock is calculated based on the scores and weights of its features. Based on this algorithm, we choose the 50 top ranking stocks to buy. We compare the performances of the portfolio with the benchmark index, S&P 500. With an initial investment of $100 in December 1999, over 15 years, in December 2014, our portfolio had an average gain per annum of 14.9% versus 2.3% for the S&P 500.

Suggested Citation

  • Nguyet Nguyen & Dung Nguyen, 2015. "Hidden Markov Model for Stock Selection," Risks, MDPI, Open Access Journal, vol. 3(4), pages 1-19, October.
  • Handle: RePEc:gam:jrisks:v:3:y:2015:i:4:p:455-473:d:58009

    Download full text from publisher

    File URL:
    Download Restriction: no

    File URL:
    Download Restriction: no

    References listed on IDEAS

    1. Andrew Ang & Geert Bekaert, 2002. "International Asset Allocation With Regime Shifts," Review of Financial Studies, Society for Financial Studies, vol. 15(4), pages 1137-1187.
    2. Guidolin, Massimo & Timmermann, Allan, 2007. "Asset allocation under multivariate regime switching," Journal of Economic Dynamics and Control, Elsevier, vol. 31(11), pages 3503-3544, November.
    Full references (including those not matched with items on IDEAS)

    More about this item


    hidden Markov model; economics; observations; regimes; prediction; stocks; scores; ranking; MLE;

    JEL classification:

    • C - Mathematical and Quantitative Methods
    • G0 - Financial Economics - - General
    • G1 - Financial Economics - - General Financial Markets
    • G2 - Financial Economics - - Financial Institutions and Services
    • G3 - Financial Economics - - Corporate Finance and Governance
    • M2 - Business Administration and Business Economics; Marketing; Accounting; Personnel Economics - - Business Economics
    • M4 - Business Administration and Business Economics; Marketing; Accounting; Personnel Economics - - Accounting
    • K2 - Law and Economics - - Regulation and Business Law


    Access and download statistics


    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:gam:jrisks:v:3:y:2015:i:4:p:455-473:d:58009. See general information about how to correct material in RePEc.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: (XML Conversion Team). General contact details of provider: .

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service hosted by the Research Division of the Federal Reserve Bank of St. Louis . RePEc uses bibliographic data supplied by the respective publishers.