fHMM: Hidden Markov Models for Financial Time Series in R

Hidden Markov models constitute a versatile class of statistical models for time series that are driven by hidden states. In financial applications, the hidden states can often be linked to market regimes such as bearish and bullish markets or recessions and periods of economics growth. To give an...

Full description

Saved in:
Bibliographic Details
Main Authors: Lennart Oelschläger, Timo Adam, Rouven Michels
Format: Article
Language:English
Published: Foundation for Open Access Statistics 2024-06-01
Series:Journal of Statistical Software
Online Access:https://www.jstatsoft.org/index.php/jss/article/view/4736
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1850035351644536832
author Lennart Oelschläger
Timo Adam
Rouven Michels
author_facet Lennart Oelschläger
Timo Adam
Rouven Michels
author_sort Lennart Oelschläger
collection DOAJ
description Hidden Markov models constitute a versatile class of statistical models for time series that are driven by hidden states. In financial applications, the hidden states can often be linked to market regimes such as bearish and bullish markets or recessions and periods of economics growth. To give an example, when the market is in a nervous state, corresponding stock returns often follow some distribution with relatively high variance, whereas calm periods are often characterized by a different distribution with relatively smaller variance. Hidden Markov models can be used to explicitly model the distribution of the observations conditional on the hidden states and the transitions between states, and thus help us to draw a comprehensive picture of market behavior. While various implementations of hidden Markov models are available, a comprehensive R package that is tailored to financial applications is still lacking. In this paper, we introduce the R package fHMM, which provides various tools for applying hidden Markov models to financial time series. It contains functions for fitting hidden Markov models to data, conducting simulation experiments, and decoding the hidden state sequence. Furthermore, functions for model checking, model selection, and state prediction are provided. In addition to basic hidden Markov models, hierarchical hidden Markov models are implemented, which can be used to jointly model multiple data streams that were observed at different temporal resolutions. The aim of the fHMM package is to give R users with an interest in financial applications access to hidden Markov models and their extensions.
format Article
id doaj-art-e476da767a0548269f39c3f9906926c9
institution DOAJ
issn 1548-7660
language English
publishDate 2024-06-01
publisher Foundation for Open Access Statistics
record_format Article
series Journal of Statistical Software
spelling doaj-art-e476da767a0548269f39c3f9906926c92025-08-20T02:57:30ZengFoundation for Open Access StatisticsJournal of Statistical Software1548-76602024-06-01109110.18637/jss.v109.i09fHMM: Hidden Markov Models for Financial Time Series in RLennart Oelschläger0Timo Adam1Rouven Michels2Bielefeld UniversityUniversity of St AndrewsBielefeld University Hidden Markov models constitute a versatile class of statistical models for time series that are driven by hidden states. In financial applications, the hidden states can often be linked to market regimes such as bearish and bullish markets or recessions and periods of economics growth. To give an example, when the market is in a nervous state, corresponding stock returns often follow some distribution with relatively high variance, whereas calm periods are often characterized by a different distribution with relatively smaller variance. Hidden Markov models can be used to explicitly model the distribution of the observations conditional on the hidden states and the transitions between states, and thus help us to draw a comprehensive picture of market behavior. While various implementations of hidden Markov models are available, a comprehensive R package that is tailored to financial applications is still lacking. In this paper, we introduce the R package fHMM, which provides various tools for applying hidden Markov models to financial time series. It contains functions for fitting hidden Markov models to data, conducting simulation experiments, and decoding the hidden state sequence. Furthermore, functions for model checking, model selection, and state prediction are provided. In addition to basic hidden Markov models, hierarchical hidden Markov models are implemented, which can be used to jointly model multiple data streams that were observed at different temporal resolutions. The aim of the fHMM package is to give R users with an interest in financial applications access to hidden Markov models and their extensions. https://www.jstatsoft.org/index.php/jss/article/view/4736
spellingShingle Lennart Oelschläger
Timo Adam
Rouven Michels
fHMM: Hidden Markov Models for Financial Time Series in R
Journal of Statistical Software
title fHMM: Hidden Markov Models for Financial Time Series in R
title_full fHMM: Hidden Markov Models for Financial Time Series in R
title_fullStr fHMM: Hidden Markov Models for Financial Time Series in R
title_full_unstemmed fHMM: Hidden Markov Models for Financial Time Series in R
title_short fHMM: Hidden Markov Models for Financial Time Series in R
title_sort fhmm hidden markov models for financial time series in r
url https://www.jstatsoft.org/index.php/jss/article/view/4736
work_keys_str_mv AT lennartoelschlager fhmmhiddenmarkovmodelsforfinancialtimeseriesinr
AT timoadam fhmmhiddenmarkovmodelsforfinancialtimeseriesinr
AT rouvenmichels fhmmhiddenmarkovmodelsforfinancialtimeseriesinr