Package: fHMM 1.4.1

fHMM: Fitting Hidden Markov Models to Financial Data

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>.

Authors:Lennart Oelschläger [aut, cre], Timo Adam [aut], Rouven Michels [aut]

fHMM_1.4.1.tar.gz
fHMM_1.4.1.zip(r-4.5)fHMM_1.4.1.zip(r-4.4)fHMM_1.4.1.zip(r-4.3)
fHMM_1.4.1.tgz(r-4.4-x86_64)fHMM_1.4.1.tgz(r-4.4-arm64)fHMM_1.4.1.tgz(r-4.3-x86_64)fHMM_1.4.1.tgz(r-4.3-arm64)
fHMM_1.4.1.tar.gz(r-4.5-noble)fHMM_1.4.1.tar.gz(r-4.4-noble)
fHMM_1.4.1.tgz(r-4.4-emscripten)fHMM_1.4.1.tgz(r-4.3-emscripten)
fHMM.pdf |fHMM.html
fHMM/json (API)
NEWS

# Install 'fHMM' in R:
install.packages('fHMM', repos = c('https://loelschlaeger.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/loelschlaeger/fhmm/issues

Uses libs:
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library
Datasets:
  • dax - Deutscher Aktienindex (DAX) index data
  • dax_model_2n - DAX 2-state HMM with normal distributions
  • dax_model_3t - DAX 3-state HMM with t-distributions
  • dax_vw_model - DAX/VW hierarchical HMM with t-distributions
  • sim_model_2gamma - Simulated 2-state HMM with gamma distributions
  • spx - Standard & Poor’s 500 (S&P 500) index data
  • unemp - Unemployment rate data USA
  • unemp_spx_model_3_2 - Unemployment rate and S&P 500 hierarchical HMM
  • vw - Volkswagen AG (VW) stock data

On CRAN:

financehidden-markov-models

7.11 score 16 stars 4 scripts 522 downloads 20 exports 99 dependencies

Last updated 2 months agofrom:4b43a1862f. Checks:OK: 9. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 15 2024
R-4.5-win-x86_64OKNov 15 2024
R-4.5-linux-x86_64OKNov 15 2024
R-4.4-win-x86_64OKNov 15 2024
R-4.4-mac-x86_64OKNov 15 2024
R-4.4-mac-aarch64OKNov 15 2024
R-4.3-win-x86_64OKNov 15 2024
R-4.3-mac-x86_64OKNov 15 2024
R-4.3-mac-aarch64OKNov 15 2024

Exports:compare_modelscompute_residualsdecode_statesdownload_datafHMM_eventsfHMM_parametersfit_modelll_hmmnparpar2parConpar2parUnconparCon2parparCon2parUnconparUncon2parparUncon2parConprepare_datareorder_statesset_controlssimulate_hmmviterbi

Dependencies:askpassassertthatbackportsBBbenchmarkmebenchmarkmeDatabriocallrcheckmateclicodetoolscolorspacecpp11crayoncurldescdiffobjdigestdoParalleldplyrevaluatefansifarverforeachfsgenericsGenOrdggfunggimageggplot2ggplotifyglueGPArotationgridGraphicsgtablehexbinhexStickerhmshttrisobanditeratorsjsonlitelabelinglatex2explatticelifecyclelubridatemagickmagrittrMASSMatrixmgcvmimemnormtmunsellmvtnormnleqslvnlmeoeliopensslpadrpillarpkgbuildpkgconfigpkgloadpracmapraiseprettyunitsprocessxprogresspspsychquadprogR6RColorBrewerRcppRcppArmadillorlangrprojrootscalesshowtextshowtextdbSimMultiCorrDatastringistringrsyssysfontstestthattibbletidyselecttimechangetriangleutf8vctrsVGAMviridisLitewaldowithryulab.utils

Controls

Rendered fromv02_controls.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-05-31
Started: 2022-01-22

Data management

Rendered fromv03_data_management.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-05-31
Started: 2022-01-13

Introduction

Rendered fromfHMM.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-05-31
Started: 2022-01-22

Model checking

Rendered fromv06_model_checking.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-05-31
Started: 2022-01-13

Model definition

Rendered fromv01_model_definition.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2023-04-05
Started: 2022-01-22

Model estimation

Rendered fromv04_model_estimation.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-05-31
Started: 2022-01-22

Model selection

Rendered fromv07_model_selection.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-05-31
Started: 2022-01-13

State decoding and prediction

Rendered fromv05_state_decoding_and_prediction.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2024-05-31
Started: 2022-03-02

Readme and manuals

Help Manual

Help pageTopics
Compare multiple modelscompare_models
Compute (pseudo-) residualscompute_residuals
Deutscher Aktienindex (DAX) index datadax
DAX 2-state HMM with normal distributionsdax_model_2n
DAX 3-state HMM with t-distributionsdax_model_3t
DAX/VW hierarchical HMM with t-distributionsdax_vw_model
Decode the underlying hidden state sequencedecode_states viterbi
Download financial data from Yahoo Financedownload_data
Constructor of an 'fHMM_data' objectfHMM_data print.fHMM_data summary.fHMM_data
Checking eventsfHMM_events print.fHMM_events
Constructor of a model objectAIC.fHMM_model BIC.fHMM_model coef.fHMM_model fHMM_model logLik.fHMM_model nobs.fHMM_model npar npar.fHMM_model predict.fHMM_model print.fHMM_model residuals.fHMM_model summary.fHMM_model
Set and check model parametersfHMM_parameters print.fHMM_parameters
Model fittingfit_model
Log-likelihood function of an (H)HMMll_hmm
Plot method for an object of class 'fHMM_data'plot.fHMM_data
Plot method for an object of class 'fHMM_model'plot.fHMM_model
Prepare dataprepare_data
Reorder estimated statesreorder_states
Define and validate model specificationsprint.fHMM_controls set_controls summary.fHMM_controls validate_controls
Simulated 2-state HMM with gamma distributionssim_model_2gamma
Simulate datasimulate_hmm
Standard & Poor’s 500 (S&P 500) index dataspx
Unemployment rate data USAunemp
Unemployment rate and S&P 500 hierarchical HMMunemp_spx_model_3_2
Volkswagen AG (VW) stock datavw