Learn R Programming

ldhmm (version 0.6.1)

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

Description

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

Copy Link

Version

Install

install.packages('ldhmm')

Monthly Downloads

185

Version

0.6.1

License

Artistic-2.0

Maintainer

Stephen Lihn

Last Published

December 11th, 2023

Functions in ldhmm (0.6.1)

ldhmm.decoding

Computing the minus log-likelihood (MLLK)
ldhmm.state_pdf

Computing the PDF per state given the observations
ldhmm.ts_abs_acf

Computing ACF of the absolute value of a time series
ldhmm.n2w

Transforming natural parameters to a linear working parameter array
ldhmm.mllk

Computing the minus log-likelihood (MLLK)
ldhmm.viterbi

Computing the global decoding by the Viterbi algorithm
ldhmm.simulate_state_transition

Simulating state transition
ldhmm.ts_log_rtn

Get log-returns from historic prices of an index
ldhmm.simulate_abs_acf

Simulating auto-correlation (ACF)
ldhmm.pseudo_residuals

Computing pseudo-residuals
ldhmm.sma

Simple moving average of a time series
ldhmm.read_csv_by_symbol

Read csv file of sample data
ldhmm.log_forward

Computing the log forward and backward probabilities
ldhmm.read_sample_object

Read sample ldhmm object
ldhmm.plot_spx_vix_obs

Plotting HMM expected volatility for SPX overlaid with adjusted VIX
ldhmm.ld_stats

Computes the theoretical statistics per state
ldhmm.forecast_volatility

Computing the volatility forecast for next one period
ldhmm.get_data

Read sample data
numericOrNull-class

The numericOrNull class
ldhmm.state_ld

Constructing the ecld objects per state
ldhmm.mle

Computing the MLEs
ldhmm.w2n

Transforming working parameter array to natural parameters
ldhmm-package

ldhmm: A package for HMM using lambda distribution.
ecld.sd

Compute statistics analytically for an ecld object
ldhmm

Constructor of ldhmm class
ecld.cdf

CDF and CCDF of ecld
ldhmm.conditional_prob

Computing the conditional probabilities
ldhmm.fred_data

Utility to download time series from FRED
ldhmm.forecast_state

Computing the state forecast
ecld

Constructor of ecld class
ldhmm.forecast_prob

Computing the forecast probability distribution
ldhmm.gamma_init

Initializing tansition probability paramter
ldhmm.calc_stats_from_obs

Computing the statistics for each state
ecld-class

An S4 class to represent the lambda distribution
ldhmm.df2ts

Utility to standardize timeseries from data.frame to xts
ecld.pdf

Calculate the PDF of an ecld object
ldhmm-class

The ldhmm class
ldhmm.decode_stats_history

Estimating historical statistics (mean, volatility and kurtosis)