fitMSM: Fitting Multifractal Models

Description Usage Arguments Details Value Examples

View source: R/fit_msm.R

Description

'fitMSM' is used to fits multifractal model. Unlike MSM package fitting function, 'fitMSM' allows leverage.

Usage

1
2
3
4
5
6
7
8
9
fitMSM(
  y,
  kbar,
  parms0 = NULL,
  p1 = NULL,
  leverage = TRUE,
  NL = NULL,
  optim.method = "nlm"
)

Arguments

y

the vector of returns.

kbar

the number of components.

parms0

the vector of starting values for the optimization with 'NULL' as default value. The vector imputs should be named (see details).

p1

the vector of initial probabilities.

leverage

a boolean value indicating if the model has leverage or not.

NL

A parameter NL as integer required for the leverage effect. The default value NULL set NL to 70, which is the suggested value by Augustyniak et al. (2019) for daily return (See details).

optim.method

the optimisation method. The expected values are "nlm", "Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "nlm" and "solnp". It is possible to combine severals optimization methods.

Details

Let {rt} a returns process. The multifractal model is given by

rt = Vt*et

where Vt is the latent variance defined by Vt = sigma2*Mt if the model is without leverage and et is an independent and identically distributed (iid) gaussian process with mean 0 and variance 1. The process {Mt} is constructed as a product of Kbar independent two-state Markov chains, denoted by M(i)t, i = 1,...,Kbar and defined on a common state space comprised of the values {m0, 2 - m0}, where m0 belongs to (0,1). The transition probability matrix of the Markov chain M(i)t is such that the diagonal entries are pi and the off-diagonal entries 1 - pi. The probability pi is defined by 0.5 + 0.5*(1 - gamma1)^(b^i), where gamma1 belongs to (0, 1) and b is a positive parameter.

When the model is with leverage effect, Vt = sigma2*Mt*Lt where, Lt definition involves two new unknown parameters, l1 and thetaL (see Augustyniak et al., 2019).

The starting values should be named as "m0", "sigma2", "gamma1" and "b" when leverage = FALSE. Additional components such that "l1" and "thetaL" should be added for leverage = TRUE.

Value

list with the following elements:

estimates

a list containing the parameters estimations and other settings of the model.

Lt

A vector of the components Lt of the latent variance.

iterations

the number of iterations the solver computes the likelihood before convergence.

convergence

a boolean value indicating if the estimation converges or not

NL

The set value for the parameter NL.

y

the vector of returns.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
# Model without leverage
parms1 <- c("m0" = 0.97, "sigma2" = 1e-2, "b" = 2.7, "gamma1" = 0.95)
y1     <- simMSM(parms = parms1, kbar = 5, leverage = FALSE)

plot(y1, type = "l")

# Model with leverage
parms2 <- c("m0" = 0.37, "sigma2" = 1e-2, "b" = 2.7, "gamma1" = 0.95, "l1" = 1.35, "thetal" = 0.99)
y2     <- simMSM(parms = parms2, kbar = 5, leverage = TRUE)

plot(y2, type = "l")

# Estimation
fit1 <- fitMSM(y1, 7, leverage = FALSE)
fit1$estimates$parms
fit1$estimates$log.likelihood

fit2 <- fitMSM(y2, 7, leverage = TRUE)
fit2$estimates$parms
fit2$estimates$log.likelihood

## End(Not run)

ahoundetoungan/multifractal documentation built on Dec. 27, 2019, 2:17 a.m.