Fits a skew hyperbolic t-distribution to given data. Displays the histogram, log-histogram (both with fitted densities), Q-Q plot and P-P plot for the fit which has maximum likelihood.
skewhypFit(x, freq = NULL, breaks = NULL, startValues = "LA",
paramStart = NULL, method = "Nelder-Mead", hessian = TRUE,
plots = FALSE, printOut = TRUE, controlBFGS = list(maxit = 200),
controlNM = list(maxit = 1000), maxitNLM = 1500, ...)
# S3 method for skewhypFit
plot(x, which = 1:4,
plotTitles = paste(c("Histogram of ", "Log-Histogram of ",
"Q-Q Plot of ", "P-P Plot of "), x$obsName, sep = ""),
ask = prod(par("mfcol")) < length(which) && dev.interactive(), ...)
# S3 method for skewhypFit
print(x,digits = max(3, getOption("digits") - 3),...)
skewhypFit
returns a list with components:
A vector giving the maximum likelihood estimates of the
parameters in the form c(mu,delta,beta,nu)
.
The value of the maximised log-likelihood.
If hessian
was set to TRUE
, the value of
the hessian, not present otherwise.
Optimisation method used.
Number of iterations of optimisation routine.
The data used to fit the distribution.
Character string with the actual x
argument name.
Starting values of the parameters returned by
skewhypFitStart
.
Name of the method used to find starting values.
Acronym of method used to find starting values.
Cell boundaries found by a call to hist
.
The cell midpoints found by a call to
hist
.
The estimated density found by a call to
hist
if startValues = "US"
, or
density
if startValues = "LA"
.
Data vector for skewhypFit
. Object of class
"skewhypFit"
for print.skewhypFit
.
Vector of weights with length equal to length of x
.
Breaks for histogram, defaults to those generated by
hist(x, plot = FALSE, right = FALSE).
If startValues = "LA"
then 30 breaks are used by default.
Code giving the method of determining starting values for finding the maximum likelihood estimates of the parameters.
If startValues = "US"
the
user must specify a vector of starting parameter values in the form
c(mu,delta,beta,nu)
.
Different optimisation methods to consider, see Details.
Logical; if hessian = TRUE
the value of the
hessian is returned.
Logical; if plots = TRUE
the histogram,
log-histogram, Q-Q and P-P plots are printed.
Logical; if printOut = TRUE
results of the
fitting are printed.
A list of control parameters for optim
when
using the "BFGS"
optimisation.
A list of control parameters for optim
when using the "Nelder-Mead"
optimisation.
A positive integer specifying the maximum number of
iterations when using the "nlm"
optimisation.
If a subset of plots is required, specify a subset of the
numbers 1:4
.
Titles to appear above the plots.
Logical; if TRUE
the user is asked before plot
change, see par(ask = .)
.
Desired number of digits when the object is printed.
Passes arguments to optim
, nlm
,
hist
, logHist
,
qqskewhyp
and ppskewhyp
.
David Scott d.scott@auckland.ac.nz, Fiona Grimson
startValues
can be either "US"
(User-supplied) or
"LA"
(Linear approximation)
If startValues = "US"
then a value for paramStart
must be
supplied. For the details concerning the use of startValues
and paramStart
see skewhypFitStart
.
The three optimisation methods currently available are:
"BFGS"
Uses the quasi-Newton method "BFGS"
as
documented in optim
.
"Nelder-Mead"
Uses an implementation of the Nelder and
Mead method as documented in optim
.
"nlm"
Uses the nlm
function in R.
For the details of how to pass control information using
optim
and nlm
, see optim
and
nlm.
Aas, K. and Haff, I. H. (2006). The Generalised Hyperbolic Skew Student's t-distribution, Journal of Financial Econometrics, 4, 275--309.
## See how well skewhypFit works
param <- c(0, 1, 4, 10)
data <- rskewhyp(500, param = param)
fit <- skewhypFit(data)
## Use data set NOK/EUR as per Aas&Haff
data(lrnokeur)
nkfit <- skewhypFit(lrnokeur, method = "nlm")
## Use data set DJI
data(lrdji)
djfit <- skewhypFit(lrdji)
Run the code above in your browser using DataLab