skewhypFit | R Documentation |
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 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),...)
x |
Data vector for |
freq |
Vector of weights with length equal to length of |
breaks |
Breaks for histogram, defaults to those generated by
|
startValues |
Code giving the method of determining starting values for finding the maximum likelihood estimates of the parameters. |
paramStart |
If |
method |
Different optimisation methods to consider, see Details. |
hessian |
Logical; if |
plots |
Logical; if |
printOut |
Logical; if |
controlBFGS |
A list of control parameters for |
controlNM |
A list of control parameters for |
maxitNLM |
A positive integer specifying the maximum number of
iterations when using the |
which |
If a subset of plots is required, specify a subset of the
numbers |
plotTitles |
Titles to appear above the plots. |
ask |
Logical; if |
digits |
Desired number of digits when the object is printed. |
... |
Passes arguments to |
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.
skewhypFit
returns a list with components:
param |
A vector giving the maximum likelihood estimates of the
parameters in the form |
maxLik |
The value of the maximised log-likelihood. |
hessian |
If |
method |
Optimisation method used. |
conv |
Convergence code. See |
iter |
Number of iterations of optimisation routine. |
x |
The data used to fit the distribution. |
xName |
Character string with the actual |
paramStart |
Starting values of the parameters returned by
|
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 |
midpoints |
The cell midpoints found by a call to
|
empDens |
The estimated density found by a call to
|
David Scott d.scott@auckland.ac.nz, Fiona Grimson
Aas, K. and Haff, I. H. (2006). The Generalised Hyperbolic Skew Student's t-distribution, Journal of Financial Econometrics, 4, 275–309.
optim
, nlm
, par
,
hist
, density,
logHist
,
qqskewhyp
, ppskewhyp
,
dskewhyp
and skewhypFitStart
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.