From 783b271120591435a1835670bec722be554a2969 Mon Sep 17 00:00:00 2001 From: loelschlaeger Date: Tue, 28 May 2024 17:02:04 +0200 Subject: [PATCH] added reference to README --- DESCRIPTION | 4 ++-- README.Rmd | 10 ++++++++-- README.md | 31 ++++++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 42ff53ea..0e498365 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,8 +20,8 @@ Authors@R: c( comment = c(ORCID = "0000-0002-5433-6197"))) Description: 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) + "Detecting Bearish and Bullish Markets in Financial Time Series Using + Hierarchical Hidden Markov Models" (2021, Statistical Modelling) 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. diff --git a/README.Rmd b/README.Rmd index ea2d0331..81979f4a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -26,9 +26,15 @@ data <- model$data [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) -The `{fHMM}` R package allows for the detection and characterization of financial market regimes in time series data by applying hidden Markov Models (HMMs). The [vignettes](https://loelschlaeger.de/fHMM/articles/) outline the package functionality and the model formulation. For a reference on the method, see +The `{fHMM}` R package allows for the detection and characterization of financial market regimes in time series data by applying hidden Markov Models (HMMs). The [vignettes](https://loelschlaeger.de/fHMM/articles/) outline the package functionality and the model formulation. -> Oelschläger, L., and T. Adam. 2021. “Detecting Bearish and Bullish Markets in Financial Time Series Using Hierarchical Hidden Markov Models.” Statistical Modelling. https://doi.org/10.1177/1471082X211034048 +For a reference on the method, see: + +> Oelschläger, L., and Adam, T. 2021. "Detecting Bearish and Bullish Markets in Financial Time Series Using Hierarchical Hidden Markov Models." Statistical Modelling. https://doi.org/10.1177/1471082X211034048 + +A user guide is provided by the accompanying software paper: + +> Oelschläger, L., Adam, T., and Michels, R. 2024. "fHMM: Hidden Markov Models for Financial Time Series in R". Journal of Statistical Software. https://doi.org/10.18637/jss.v109.i09 Below, we illustrate an application to the German stock index [DAX](https://en.wikipedia.org/wiki/DAX). We also show how to use the package to simulate HMM data, compute the model likelihood, and decode the hidden states using the Viterbi algorithm. diff --git a/README.md b/README.md index 9f5f2d41..a005c569 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,21 @@ stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https:// The `{fHMM}` R package allows for the detection and characterization of financial market regimes in time series data by applying hidden Markov Models (HMMs). The [vignettes](https://loelschlaeger.de/fHMM/articles/) -outline the package functionality and the model formulation. For a -reference on the method, see +outline the package functionality and the model formulation. -> Oelschläger, L., and T. Adam. 2021. “Detecting Bearish and Bullish +For a reference on the method, see: + +> Oelschläger, L., and Adam, T. 2021. “Detecting Bearish and Bullish > Markets in Financial Time Series Using Hierarchical Hidden Markov > Models.” Statistical Modelling. > +A user guide is provided by the accompanying software paper: + +> Oelschläger, L., Adam, T., and Michels, R. 2024. “fHMM: Hidden Markov +> Models for Financial Time Series in R”. Journal of Statistical +> Software. + Below, we illustrate an application to the German stock index [DAX](https://en.wikipedia.org/wiki/DAX). We also show how to use the package to simulate HMM data, compute the model likelihood, and decode @@ -238,6 +245,9 @@ exponential link). ``` r ll_hmm(parUncon, sim$data, controls) #> [1] -1620.515 +``` + +``` r ll_hmm(parUncon, sim$data, controls, negative = TRUE) #> [1] 1620.515 ``` @@ -267,21 +277,36 @@ par$Gamma #> state_1 state_2 #> state_1 0.95 0.05 #> state_2 0.05 0.95 +``` + +``` r estimate$Gamma #> state_1 state_2 #> state_1 0.96895127 0.03104873 #> state_2 0.03037199 0.96962801 +``` + +``` r par$mu #> muCon_1 muCon_2 #> 1 3 +``` + +``` r estimate$mu #> muCon_1 muCon_2 #> 1.061835 2.899473 +``` + +``` r par$sigma #> sigmaCon_1 sigmaCon_2 #> 1 3 +``` + +``` r estimate$sigma #> sigmaCon_1 sigmaCon_2 #> 1.122073 2.943097