Fitting Hidden Markov Models to Financial Data
Plot method for an object of class fHMM_model
Prepare data
Read data
Reorder estimated states
Define and validate model specifications
Check date format
Compare multiple models
Compute confidence intervals
Compute (pseudo-) residuals
Compute lengths of fine-scale chunks
Decode the underlying hidden state sequence
Download financial data from Yahoo Finance
Set color scheme for visualizations
Constructor of an fHMM_data
object
Checking events
Constructor of a model object
Set and check model parameters
Define state-dependent distributions
fHMM: Fitting Hidden Markov Models to Financial Data
Find closest year
Model fitting
Initialization of numerical likelihood optimization
List to vector
Log-likelihood function of an (H)HMM
Negative log-likelihood function of an HHMM
Negative log-likelihood function of an HMM
Create labels for estimated parameters
Parameter transformations
Visualization of log-likelihood values
Visualize pseudo residuals
Visualization of estimated state-dependent distributions
Visualize time series
Plot method for an object of class fHMM_data
Simulate data
Simulate state-dependent observations
Fitting (hierarchical) hidden Markov models to financial data via maximum likelihood estimation. See Oelschläger, L. and Adam, T. "Detecting Bearish and Bullish Markets in Financial Time Series Using Hierarchical Hidden Markov Models" (2021, Statistical Modelling) <doi:10.1177/1471082X211034048> for a reference on the method. A user guide is provided by the accompanying software paper "fHMM: Hidden Markov Models for Financial Time Series in R", Oelschläger, L., Adam, T., and Michels, R. (2024, Journal of Statistical Software) <doi:10.18637/jss.v109.i09>.