# ldhmm.mle: Computing the MLEs In ldhmm: Hidden Markov Model for Financial Time-Series Based on Lambda Distribution

## Description

Computing the MLEs using `nlm` package

## Usage

 ```1 2 3``` ```ldhmm.mle(object, x, min.gamma = 1e-06, decode = FALSE, plot.fn = NULL, plot.interval = 200, ssm.fn = NULL, print.level = 0, iterlim = 1000, ...) ```

## Arguments

 `object` an ldhmm object that can supply m, param.nbr and stationary. `x` numeric, the observations. `min.gamma` numeric, a minimum transition probability added to gamma to avoid singularity, default is `1e-6`. `decode` logical, run decoding after optimization, default is `FALSE`. `plot.fn` name of the function that takes ldhmm object. It will be called occasionally to track the progress of the fit, mainly by plotting the time series and states. E.g. When one fits the SPX index, the function `ldhmm.oxford_man_plot_obs` can be used to show the expected volatility vs Oxford-Man realized volatility. Default is `NULL`. `plot.interval` a positive integer, specifying how often to invoke plot function, default is 200 iterations. `ssm.fn` name of the function that takes ldhmm object. This function is called after the MLLK call. The purpose is to generate an additional score for optimization. E.g. It can be used to separate the states into predefined intervals, modeling a state space model. Default is `NULL`. `print.level` numeric, this argument determines the level of printing which is done during the minimization process. The default value of 0 means that no printing occurs, a value of 1 means that initial and final details are printed and a value of 2 means that full tracing information is printed. `iterlim` numeric, a positive integer specifying the maximum number of iterations to be performed before the program is terminated. `...` additional parameters passed to the MLE optimizer

## Value

an ldhmm object containg results of MLE optimization

Stephen H. Lihn

## Examples

 ```1 2 3 4 5 6 7 8``` ```## Not run: param0 <- matrix(c(0.003, 0.02, 1, -0.006, 0.03, 1.3), 2, 3, byrow=TRUE) gamma0 <- ldhmm.gamma_init(m=2, prob=c(0.9, 0.1, 0.1, 0.9)) h <- ldhmm(m=2, param=param0, gamma=gamma0) spx <- ldhmm.ts_log_rtn() ldhmm.mle(h, spx\$x) ## End(Not run) ```

### Example output

```An object of class "ldhmm"
Slot "call":
ldhmm(m = m, param = param, gamma = gamma, delta = delta, stationary = stationary,
mle.optimizer = object@mle.optimizer)

Slot "m":
 2

Slot "param.nbr":
 3

Slot "param":
mu      sigma   lambda
[1,]  0.002661158 0.01955254 1.088500
[2,] -0.001015295 0.03596224 1.332212

Slot "gamma":
[,1]       [,2]
[1,] 0.98632919 0.01367081
[2,] 0.03369705 0.96630295

Slot "delta":
 0.7113905 0.2886095

Slot "stationary":
 TRUE

Slot "mle.optimizer":
 "nlm"

Slot "return.code":
 1

Slot "iterations":
 33

Slot "mllk":
 -8831.681

Slot "AIC":
 -17647.36

Slot "BIC":
 -17598.21

Slot "observations":
numeric(0)

Slot "states.prob":
<0 x 0 matrix>

Slot "states.local":
numeric(0)

Slot "states.global":
numeric(0)

Slot "states.local.stats":
<0 x 0 matrix>

Slot "states.global.stats":
<0 x 0 matrix>
```

ldhmm documentation built on Jan. 11, 2020, 9:16 a.m.
{"ft_lang_label":"__label__en","ft_lang_prob":0.62503785,"math_prob":0.9671418,"size":2749,"snap":"2021-31-2021-39","text_gpt3_token_len":853,"char_repetition_ratio":0.12714025,"word_repetition_ratio":0.027842227,"special_character_ratio":0.33721355,"punctuation_ratio":0.21440536,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9803707,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-08-03T23:52:13Z\",\"WARC-Record-ID\":\"<urn:uuid:4ea15041-0ac9-4e9c-a93c-07e3cc0f3f45>\",\"Content-Length\":\"53175\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:280f37c9-3219-48a9-ab99-6ffbe55c4c88>\",\"WARC-Concurrent-To\":\"<urn:uuid:f4b39075-3926-434c-8536-bb1eabfb5a6e>\",\"WARC-IP-Address\":\"51.81.83.12\",\"WARC-Target-URI\":\"https://rdrr.io/cran/ldhmm/man/ldhmm.mle.html\",\"WARC-Payload-Digest\":\"sha1:GWKREY7E3IYSLWWKCJRZUMHP62LSZKBG\",\"WARC-Block-Digest\":\"sha1:6A7ERJ5XR5BMTHKYXYGOETPGXFZIPU22\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-31/CC-MAIN-2021-31_segments_1627046154486.47_warc_CC-MAIN-20210803222541-20210804012541-00091.warc.gz\"}"}