skewhypFit {SkewHyperbolic}R Documentation

Fit the Skew Hyperbolic Student t-Distribution to Data

Description

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.

Usage

skewhypFit(x, freq = NULL, breaks = NULL, startValues = "LA",
           paramStart = NULL, method = "Nelder-Mead", hessian = TRUE,
           plots = TRUE, printOut = TRUE, controlBFGS = list(maxit = 200),
           controlNM = list(maxit = 1000), maxitNLM = 1500, ...)
## S3 method for class '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 class 'skewhypFit':
print(x,digits = max(3, getOption("digits") - 3),...)

Arguments

x Data vector for skewhypFit. Object of class "skewhypFit" for print.skewhypFit.
freq Vector of weights with length equal to length of x.
breaks Breaks for histogram, defaults to those generated by hist(x, plot = FALSE, right = FALSE).If startValues = "LA" then 30 breaks are used by default.
startValues Code giving the method of determining starting values for finding the maximum likelihood estimates of the parameters.
paramStart If startValues = "US" the user must specify a vector of starting parameter values in the form c(mu,delta,beta,nu).
method Different optimisation methods to consider, see Details.
hessian Logical; if hessian = TRUE the value of the hessian is returned.
plots Logical; if plots = TRUE the histogram, log-histogram, Q-Q and P-P plots are printed.
printOut Logical; if printOut = TRUE results of the fitting are printed.
controlBFGS A list of control parameters for optim when using the "BFGS" optimisation.
controlNM A list of control parameters for optim when using the "Nelder-Mead" optimisation.
maxitNLM A positive integer specifying the maximum number of iterations when using the "nlm" optimisation.
which If a subset of plots is required, specify a subset of the numbers 1:4.
plotTitles Titles to appear above the plots.
ask Logical; if TRUE the user is asked before plot change, see par(ask = .).
digits Desired number of digits when the object is printed.
... Passes arguments to optim, nlm, hist,logHist, qqskewhyp and ppskewhyp.

Details

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:

For the details of how to pass control information using optim and nlm, see optim and nlm.

Value

skewhypFit returns a list with components:

param A vector giving the maximum likelihood estimates of the parameters in the form c(mu,delta,beta,nu).
maxLik The value of the maximised log-likelihood.
hessian If hessian was set to TRUE, the value of the hessian, not present otherwise.
method Optimisation method used.
conv Convergence code. See optim or nlm for details.
iter Number of iterations of optimisation routine.
x The data used to fit the distribution.
xName Character string with the actual x argument name.
paramStart Starting values of the parameters returned by skewhypFitStart.
svName Name of the method used to find starting values.
startValues Acronym of method used to find starting values.
breaks Cell boundaries found by a call to hist.
midpoints The cell midpoints found by a call to hist.
empDens The estimated density found by a call to hist if startValues = "US", or density if startValues = "LA".

Author(s)

David Scott d.scott@auckland.ac.nz, Fiona Grimson

References

Aas, K. and Haff, I. H. (2006). The Generalised Hyperbolic Skew Student's t-distribution, Journal of Financial Econometrics, 4, 275–309.

See Also

optim, nlm, par, hist, density, logHist, qqskewhyp, ppskewhyp, dskewhyp and skewhypFitStart.

Examples

## 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)

[Package SkewHyperbolic version 0.1-2 Index]