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.
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
)
numeric, the observation of log-returns.
numeric, the breaks for the histogram of observations.
For lme
, this parameter is only for display purpose.
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.
character, optimization algorithm to use, it could be either
fast.mle
, mle
, or pdf.lms
. Default is fast.mle
.
numeric, fix convolution to a specific number, default is NaN
.
numeric, fix annualized beta to a specific number, default is NaN
.
numeric, fix \(\nu_0/\theta\) ratio to a specific number, default is NaN
.
logical, if specified, to derive mu
automatically, default is TRUE
.
numeric, interval of iterations to plot the fit, default is 20. If set to zero, the plot is disabled.
numeric, interval of iterations to print verbose message, default is 20. If set to zero, the verbose message is disabled.
numeric, specify maximum iterations for optimx, default is 500.
a list of two components: qsld
as an object of sld class representing the QSLD fit;
optimx.out
storing the raw output from optimx
.
# 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
# }
Run the code above in your browser using DataLab