qsld.fit: Fit observations to QSLD via MLE

qsld.fitR Documentation

Fit observations to QSLD via MLE

Description

This utility will fit the observations to qsld with MLE using optimx. There are three features: First, it has the ability to provide initial estimate to save the user from the headache of guessing. Second, the user has the flexibility of fixing convolution, beta.a, and/or nu0/theta ratio. And the user can ask the utility to estimate mu as well. Third, the MLE optimization comes with two flavors: (a) the log-likelihood calculated from the PDF of all observations; or (b) the log-likelihood calculated from the histogram of the observations. The later is much faster than the former. One can use the later to obtain a good estimate, then feed it into the former, if necessary. This utility also comes with an LMS regression method called "pdf.lms". This option can be used as a preprocessor to the MLE methods. It regresses the theoretical PDF against the empirical PDF obtained from the histogram, and minimizes the LMS of PDF difference within 2-stdev and log(PDF) difference within 4-stdev.

Usage

qsld.fit(
  x,
  breaks,
  init.qsld,
  method = "fast.mle",
  fix.convo = NaN,
  fix.beta.a = NaN,
  fix.nu0.ratio = NaN,
  derive.mu = TRUE,
  plot.interval = 20,
  verbose.interval = 20,
  itnmax = 500
)

Arguments

x

numeric, the observation of log-returns.

breaks

numeric, the breaks for the histogram of observations. For lme, this parameter is only for display purpose.

init.qsld

an object of sld class as an initial qsld guess. The user can request the utility to estimate the initial parameters by setting nu0 to NaN. However, t must be provided.

method

character, optimization algorithm to use, it could be either fast.mle, mle, or pdf.lms. Default is fast.mle.

fix.convo

numeric, fix convolution to a specific number, default is NaN.

fix.beta.a

numeric, fix annualized beta to a specific number, default is NaN.

fix.nu0.ratio

numeric, fix ν_0/θ ratio to a specific number, default is NaN.

derive.mu

logical, if specified, to derive mu automatically, default is TRUE.

plot.interval

numeric, interval of iterations to plot the fit, default is 20. If set to zero, the plot is disabled.

verbose.interval

numeric, interval of iterations to print verbose message, default is 20. If set to zero, the verbose message is disabled.

itnmax

numeric, specify maximum iterations for optimx, default is 500.

Value

a list of two components: qsld as an object of sld class representing the QSLD fit; optimx.out storing the raw output from optimx.

Author(s)

Stephen H-T. Lihn

Examples

## Not run: 
  x <- ecd.data.arr("spx", lag=1, drop=1)$x
  breaks <- 200
  t <- 1/250
  d <- qsld(t=t)
  d@nu0 <- NaN # request utility to estimate

## End(Not run)

ecd documentation built on May 10, 2022, 1:07 a.m.