Package: fHMM 1.4.1

Lennart Oelschläger

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.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://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

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

Pkgdown:https://loelschlaeger.de

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

4.45 score 4 scripts 555 downloads 20 exports 113 dependencies

Last updated 3 months agofrom:6f628087a1. Checks:OK: 2. Indexed: no.

TargetResultDate
Doc / VignettesOKNov 16 2024
R-4.5-linux-x86_64OKNov 16 2024

Exports:compare_modelscompute_residualsdecode_statesdownload_datafHMM_eventsfHMM_parametersfit_modelll_hmmnparpar2parConpar2parUnconparCon2parparCon2parUnconparUncon2parparUncon2parConprepare_datareorder_statesset_controlssimulate_hmmviterbi

Dependencies:askpassassertthatbackportsBBbenchmarkmebenchmarkmeDatabriocallrcheckmateclicliprcodetoolscolorspacecpp11crayoncredentialscurldescdiffobjdigestdoParalleldplyrevaluatefansifarverforeachfsgenericsGenOrdgertggfunggimageggplot2ggplotifyghgitcredsglueGPArotationgridGraphicsgtablehexbinhexStickerhmshttrhttr2iniisobanditeratorsjsonlitelabelinglatex2explatticelifecyclelubridatemagickmagrittrMASSMatrixmgcvmimemnormtmunsellmvtnormnleqslvnlmeoeliopensslpadrpillarpkgbuildpkgconfigpkgloadpracmapraiseprettyunitsprocessxprogresspspsychpurrrquadprogR6rappdirsRColorBrewerRcppRcppArmadillorlangrprojrootrstudioapiscalesshowtextshowtextdbSimMultiCorrDatastringistringrsyssysfontstestthattibbletidyselecttimechangetriangleusethisutf8vctrsVGAMviridisLitewaldowhiskerwithryamlyulab.utilszip

Controls

Rendered fromv02_controls.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

Data management

Rendered fromv03_data_management.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

Introduction

Rendered fromfHMM.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

Model checking

Rendered fromv06_model_checking.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

Model definition

Rendered fromv01_model_definition.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

Model estimation

Rendered fromv04_model_estimation.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

Model selection

Rendered fromv07_model_selection.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

State decoding and prediction

Rendered fromv05_state_decoding_and_prediction.Rmdusingknitr::rmarkdownon Nov 16 2024.

Last update: 2024-09-17
Started: 2022-03-14

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