Fit the Generalized Inverse Gausssian Distribution to Data
Fits a generalized inverse Gaussian distribution to data. Displays the histogram, log-histogram (both with fitted densities), Q-Q plot and P-P plot for the fit which has the maximum likelihood.
gigFit(x, freq = NULL, paramStart = NULL, startMethod = c("Nelder-Mead","BFGS"), startValues = c("LM","GammaIG","MoM","Symb","US"), method = c("Nelder-Mead","BFGS","nlm"), stand = TRUE, plots = FALSE, printOut = FALSE, controlBFGS = list(maxit = 200), controlNM = list(maxit = 1000), maxitNLM = 1500, ...) ## S3 method for class 'gigFit' print(x, digits = max(3, getOption("digits") - 3), ...) ## S3 method for class 'gigFit' 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 'gigFit' coef(object, ...) ## S3 method for class 'gigFit' vcov(object, ...)
x |
Data vector for |
freq |
A vector of weights with length equal to |
paramStart |
A user specified starting parameter vector
|
startMethod |
Method used by |
startValues |
Code giving the method of determining starting
values for finding the maximum likelihood estimate of |
method |
Different optimisation methods to consider. See Details. |
stand |
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 |
digits |
Desired number of digits when the object is printed. |
which |
If a subset of the plots is required, specify a subset of
the numbers |
plotTitles |
Titles to appear above the plots. |
ask |
Logical. If |
... |
Passes arguments to |
object |
Object of class |
Possible values of the argument startValues
are the following:
"LM"
Based on fitting linear models to the upper tails
of the data x
and the inverse of the data 1/x
.
"GammaIG"
Based on fitting gamma and inverse gamma
distributions.
"MoM"
Method of moments.
"Symb"
Not yet implemented.
"US"
User-supplied.
If startValues = "US"
then a value must be supplied for
paramStart
.
For the details concerning the use of paramStart
,
startMethod
, and startValues
, see
gigFitStart
.
The three optimisation methods currently available are:
When method = "nlm"
is used, warnings may be produced. These do
not appear to be a problem.
gigFit
returns a list with components:
param |
A vector giving the maximum likelihood estimate of
param, as |
maxLik |
The value of the maximised log-likelihood. |
method |
Optimisation method used. |
conv |
Convergence code. See the relevant documentation (either
|
iter |
Number of iterations of optimisation routine. |
obs |
The data used to fit the generalized inverse Gaussian distribution. |
obsName |
A character string with the actual |
paramStart |
Starting value of |
svName |
Descriptive name for the method finding start values. |
startValues |
Acronym for the method of finding start values. |
breaks |
The 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, David Cusack
Jörgensen, B. (1982). Statistical Properties of the Generalized Inverse Gaussian Distribution. Lecture Notes in Statistics, Vol. 9, Springer-Verlag, New York.
optim
, par
,
hist
, logHist
(pkg DistributionUtils),
qqgig
, ppgig
, and gigFitStart
.
param <- c(1, 1, 1) dataVector <- rgig(500, param = param) ## See how well gigFit works gigFit(dataVector) ##gigFit(dataVector, plots = TRUE) ## See how well gigFit works in the limiting cases ## Gamma case dataVector2 <- rgamma(500, shape = 1, rate = 1) gigFit(dataVector2) ## Inverse gamma require(actuar) dataVector3 <- rinvgamma(500, shape = 1, rate = 1) gigFit(dataVector3) ## Use nlm instead of default gigFit(dataVector, method = "nlm")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.