Package: ldhmm 0.6.1

ldhmm: Hidden Markov Model for Financial Time-Series Based on Lambda Distribution

Hidden Markov Model (HMM) based on symmetric lambda distribution framework is implemented for the study of return time-series in the financial market. Major features in the S&P500 index, such as regime identification, volatility clustering, and anti-correlation between return and volatility, can be extracted from HMM cleanly. Univariate symmetric lambda distribution is essentially a location-scale family of exponential power distribution. Such distribution is suitable for describing highly leptokurtic time series obtained from the financial market. It provides a theoretically solid foundation to explore such data where the normal distribution is not adequate. The HMM implementation follows closely the book: "Hidden Markov Models for Time Series", by Zucchini, MacDonald, Langrock (2016).

Authors:Stephen H-T. Lihn [aut, cre]

ldhmm_0.6.1.tar.gz
ldhmm_0.6.1.zip(r-4.5)ldhmm_0.6.1.zip(r-4.4)ldhmm_0.6.1.zip(r-4.3)
ldhmm_0.6.1.tgz(r-4.4-any)ldhmm_0.6.1.tgz(r-4.3-any)
ldhmm_0.6.1.tar.gz(r-4.5-noble)ldhmm_0.6.1.tar.gz(r-4.4-noble)
ldhmm_0.6.1.tgz(r-4.4-emscripten)ldhmm_0.6.1.tgz(r-4.3-emscripten)
ldhmm.pdf |ldhmm.html
ldhmm/json (API)
NEWS

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

Peer review:

On CRAN:

This package does not link to any Github/Gitlab/R-forge repository. No issue tracker or development information is available.

44 exports 2 stars 0.36 score 37 dependencies 19 scripts 221 downloads

Last updated 9 months agofrom:a013108005. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 18 2024
R-4.5-winOKSep 18 2024
R-4.5-linuxOKSep 18 2024
R-4.4-winOKSep 18 2024
R-4.4-macOKSep 18 2024
R-4.3-winOKSep 18 2024
R-4.3-macOKSep 18 2024

Exports:ecldecld.ccdfecld.cdfecld.kurtecld.kurtosisecld.meanecld.pdfecld.sdecld.skewnessecld.varldhmmldhmm.calc_stats_from_obsldhmm.conditional_probldhmm.decode_stats_historyldhmm.decodingldhmm.df2tsldhmm.drop_outliersldhmm.forecast_probldhmm.forecast_stateldhmm.forecast_volatilityldhmm.fred_dataldhmm.gamma_initldhmm.get_dataldhmm.get_data.arrldhmm.get_data.tsldhmm.ld_statsldhmm.log_backwardldhmm.log_forwardldhmm.mleldhmm.mllkldhmm.n2wldhmm.plot_spx_vix_obsldhmm.pseudo_residualsldhmm.read_csv_by_symbolldhmm.read_sample_objectldhmm.simulate_abs_acfldhmm.simulate_state_transitionldhmm.smaldhmm.state_ldldhmm.state_pdfldhmm.ts_abs_acfldhmm.ts_log_rtnldhmm.viterbildhmm.w2n

Dependencies:clicolorspacefansifarverggplot2gluegnormgtableisobandlabelinglatticelifecyclemagrittrMASSMatrixmgcvmomentsmunsellnlmenloptrnumDerivoptimxpillarpkgconfigpracmaR6RColorBrewerrlangscalestibbleutf8vctrsviridisLitewithrxtsyamlzoo

Readme and manuals

Help Manual

Help pageTopics
ldhmm: A package for HMM using lambda distribution.ldhmm-package
Constructor of ecld classecld
An S4 class to represent the lambda distributionecld-class
CDF and CCDF of ecldecld.ccdf ecld.cdf
Calculate the PDF of an ecld objectecld.pdf
Compute statistics analytically for an ecld objectecld.kurt ecld.kurtosis ecld.mean ecld.sd ecld.skewness ecld.var
Constructor of ldhmm classldhmm
The ldhmm classldhmm-class
Computing the statistics for each stateldhmm.calc_stats_from_obs ldhmm.drop_outliers
Computing the conditional probabilitiesldhmm.conditional_prob
Estimating historical statistics (mean, volatility and kurtosis)ldhmm.decode_stats_history
Computing the minus log-likelihood (MLLK)ldhmm.decoding
Utility to standardize timeseries from data.frame to xtsldhmm.df2ts
Computing the forecast probability distributionldhmm.forecast_prob
Computing the state forecastldhmm.forecast_state
Computing the volatility forecast for next one periodldhmm.forecast_volatility
Utility to download time series from FREDldhmm.fred_data
Initializing tansition probability paramterldhmm.gamma_init
Read sample dataldhmm.get_data ldhmm.get_data.arr ldhmm.get_data.ts
Computes the theoretical statistics per stateldhmm.ld_stats
Computing the log forward and backward probabilitiesldhmm.log_backward ldhmm.log_forward
Computing the MLEsldhmm.mle
Computing the minus log-likelihood (MLLK)ldhmm.mllk
Transforming natural parameters to a linear working parameter arrayldhmm.n2w
Plotting HMM expected volatility for SPX overlaid with adjusted VIXldhmm.plot_spx_vix_obs
Computing pseudo-residualsldhmm.pseudo_residuals
Read csv file of sample dataldhmm.read_csv_by_symbol
Read sample ldhmm objectldhmm.read_sample_object
Simulating auto-correlation (ACF)ldhmm.simulate_abs_acf
Simulating state transitionldhmm.simulate_state_transition
Simple moving average of a time seriesldhmm.sma
Constructing the ecld objects per stateldhmm.state_ld
Computing the PDF per state given the observationsldhmm.state_pdf
Computing ACF of the absolute value of a time seriesldhmm.ts_abs_acf
Get log-returns from historic prices of an indexldhmm.ts_log_rtn
Computing the global decoding by the Viterbi algorithmldhmm.viterbi
Transforming working parameter array to natural parametersldhmm.w2n
The numericOrNull classnumericOrNull-class