Estimates the parameters of a normal inverse Gaussian distribution.

## Usage

nigFit(x, alpha = 1, beta = 0, delta = 1, mu = 0,
method = c("mle", "gmm", "mps", "vmps"), scale = TRUE, doplot = TRUE,
span = "auto", trace = TRUE, title = NULL, description = NULL, ...)

## Arguments

alpha, beta, delta, mu

The parameters are alpha, beta, delta, and mu:
shape parameter alpha; skewness parameter beta, abs(beta) is in the range (0, alpha); scale parameter delta, delta must be zero or positive; location parameter mu, by default 0. These is the meaning of the parameters in the first parameterization pm=1 which is the default parameterization selection. In the second parameterization, pm=2 alpha and beta take the meaning of the shape parameters (usually named) zeta and rho. In the third parameterization, pm=3 alpha and beta take the meaning of the shape parameters (usually named) xi and chi. In the fourth parameterization, pm=4 alpha and beta take the meaning of the shape parameters (usually named) a.bar and b.bar.

description

a character string which allows for a brief description.

doplot

a logical flag. Should a plot be displayed?

method

a character string. Either "mle", Maximum Likelihood Estimation, the default, "gmm" Gemeralized Method of Moments Estimation, "mps" Maximum Product Spacings Estimation, or "vmps" Minimum Variance Product Spacings Estimation.

scale

a logical flag, by default TRUE. Should the time series be scaled by its standard deviation to achieve a more stable optimization?

span

x-coordinates for the plot, by default 100 values automatically selected and ranging between the 0.001, and 0.999 quantiles. Alternatively, you can specify the range by an expression like span=seq(min, max, times = n), where, min and max are the left and right endpoints of the range, and n gives the number of the intermediate points.

title

a character string which allows for a project title.

trace

a logical flag. Should the parameter estimation process be traced?

x

a numeric vector.

...

parameters to be parsed.

## Value

an object from class "fDISTFIT".

Slot fit is a list with the following components:

estimate

the point at which the maximum value of the log liklihood function is obtained.

minimum

the value of the estimated maximum, i.e. the value of the log liklihood function.

code

an integer indicating why the optimization process terminated.
1: relative gradient is close to zero, current iterate is probably solution;
2: successive iterates within tolerance, current iterate is probably solution;
3: last global step failed to locate a point lower than estimate. Either estimate is an approximate local minimum of the function or steptol is too small;
4: iteration limit exceeded;
5: maximum step size stepmax exceeded five consecutive times. Either the function is unbounded below, becomes asymptotic to a finite value from above in some direction or stepmax is too small.

the gradient at the estimated maximum.

steps

number of function calls.

## Examples

## nigFit -
# Simulate Random Variates:
set.seed(1953)
s = rnig(n = 1000, alpha = 1.5, beta = 0.3, delta = 0.5, mu = -1.0)

## nigFit -
# Fit Parameters:
nigFit(s, alpha = 1, beta = 0, delta = 1, mu = mean(s), doplot = TRUE)
#>
#>  Objective Function Value:   -1646.542
#>  Parameter Estimates:        1 0 1 -0.9230541
#>
#>  Objective Function Value:   -1646.542
#>  Parameter Estimates:        1 0 1 -0.9230541
#>
#>  Objective Function Value:   -1646.542
#>  Parameter Estimates:        1 1.490116e-08 1 -0.9230541
#>
#>  Objective Function Value:   -1646.542
#>  Parameter Estimates:        1 0 1 -0.9230541
#>
#>  Objective Function Value:   -1646.542
#>  Parameter Estimates:        1 0 1 -0.9230541
#>
#>  Objective Function Value:   -1739.817
#>  Parameter Estimates:        0.8878693 -0.590966 1.226999 -1.68899
#>
#>  Objective Function Value:   -1393.208
#>  Parameter Estimates:        0.9484807 -0.2715238 1.104297 -1.274969
#>
#>  Objective Function Value:   -1393.206
#>  Parameter Estimates:        0.9485159 -0.2715238 1.104297 -1.274969
#>
#>  Objective Function Value:   -1393.206
#>  Parameter Estimates:        0.9484807 -0.2714886 1.104297 -1.274969
#>
#>  Objective Function Value:   -1393.207
#>  Parameter Estimates:        0.9484807 -0.2715238 1.104261 -1.274969
#>
#>  Objective Function Value:   -1393.212
#>  Parameter Estimates:        0.9484807 -0.2715238 1.104297 -1.274934
#>
#>  Objective Function Value:   -1368.376
#>  Parameter Estimates:        1.154588 -0.0887069 0.9729932 -1.61842
#>
#>  Objective Function Value:   -1368.376
#>  Parameter Estimates:        1.154584 -0.0887069 0.9729932 -1.61842
#>
#>  Objective Function Value:   -1368.376
#>  Parameter Estimates:        1.154588 -0.08870801 0.9729932 -1.61842
#>
#>  Objective Function Value:   -1368.376
#>  Parameter Estimates:        1.154588 -0.0887069 0.9729958 -1.61842
#>
#>  Objective Function Value:   -1368.376
#>  Parameter Estimates:        1.154588 -0.0887069 0.9729932 -1.618419
#>
#>  Objective Function Value:   -1404.634
#>  Parameter Estimates:        1.062064 0.3250035 1.147836 -1.589885
#>
#>  Objective Function Value:   -1362.03
#>  Parameter Estimates:        1.130711 0.0277694 0.9984241 -1.526042
#>
#>  Objective Function Value:   -1362.03
#>  Parameter Estimates:        1.130714 0.0277694 0.9984241 -1.526042
#>
#>  Objective Function Value:   -1362.03
#>  Parameter Estimates:        1.130711 0.02776652 0.9984241 -1.526042
#>
#>  Objective Function Value:   -1362.03
#>  Parameter Estimates:        1.130711 0.0277694 0.9984199 -1.526042
#>
#>  Objective Function Value:   -1362.03
#>  Parameter Estimates:        1.130711 0.0277694 0.9984241 -1.526044
#>
#>  Objective Function Value:   -1353.398
#>  Parameter Estimates:        1.087529 0.07355573 1.048191 -1.655963
#>
#>  Objective Function Value:   -1353.398
#>  Parameter Estimates:        1.087535 0.07355573 1.048191 -1.655963
#>
#>  Objective Function Value:   -1353.398
#>  Parameter Estimates:        1.087529 0.07355694 1.048191 -1.655963
#>
#>  Objective Function Value:   -1353.398
#>  Parameter Estimates:        1.087529 0.07355573 1.048185 -1.655963
#>
#>  Objective Function Value:   -1353.398
#>  Parameter Estimates:        1.087529 0.07355573 1.048191 -1.655962
#>
#>  Objective Function Value:   -1353.605
#>  Parameter Estimates:        1.018147 0.2015899 1.015051 -1.687778
#>
#>  Objective Function Value:   -1352.735
#>  Parameter Estimates:        1.074745 0.1420491 1.025164 -1.656674
#>
#>  Objective Function Value:   -1352.735
#>  Parameter Estimates:        1.074749 0.1420491 1.025164 -1.656674
#>
#>  Objective Function Value:   -1352.735
#>  Parameter Estimates:        1.074745 0.1420474 1.025164 -1.656674
#>
#>  Objective Function Value:   -1352.735
#>  Parameter Estimates:        1.074745 0.1420491 1.025167 -1.656674
#>
#>  Objective Function Value:   -1352.735
#>  Parameter Estimates:        1.074745 0.1420491 1.025164 -1.656676
#>
#>  Objective Function Value:   -1350.972
#>  Parameter Estimates:        1.033818 0.1360954 0.9857381 -1.702725
#>
#>  Objective Function Value:   -1350.972
#>  Parameter Estimates:        1.033812 0.1360954 0.9857381 -1.702725
#>
#>  Objective Function Value:   -1350.972
#>  Parameter Estimates:        1.033818 0.1360965 0.9857381 -1.702725
#>
#>  Objective Function Value:   -1350.972
#>  Parameter Estimates:        1.033818 0.1360954 0.9857461 -1.702725
#>
#>  Objective Function Value:   -1350.972
#>  Parameter Estimates:        1.033818 0.1360954 0.9857381 -1.702724
#>
#>  Objective Function Value:   -1350.416
#>  Parameter Estimates:        0.9827402 0.1703297 0.9458791 -1.706703
#>
#>  Objective Function Value:   -1350.415
#>  Parameter Estimates:        0.9827471 0.1703297 0.9458791 -1.706703
#>
#>  Objective Function Value:   -1350.416
#>  Parameter Estimates:        0.9827402 0.1703284 0.9458791 -1.706703
#>
#>  Objective Function Value:   -1350.416
#>  Parameter Estimates:        0.9827402 0.1703297 0.9458849 -1.706703
#>
#>  Objective Function Value:   -1350.415
#>  Parameter Estimates:        0.9827402 0.1703297 0.9458791 -1.706704
#>
#>  Objective Function Value:   -1350.454
#>  Parameter Estimates:        0.9391718 0.1628042 0.8910938 -1.727421
#>
#>  Objective Function Value:   -1350.314
#>  Parameter Estimates:        0.9691065 0.1635911 0.9212719 -1.726361
#>
#>  Objective Function Value:   -1350.314
#>  Parameter Estimates:        0.9691017 0.1635911 0.9212719 -1.726361
#>
#>  Objective Function Value:   -1350.314
#>  Parameter Estimates:        0.9691065 0.1635923 0.9212719 -1.726361
#>
#>  Objective Function Value:   -1350.314
#>  Parameter Estimates:        0.9691065 0.1635911 0.9212788 -1.726361
#>
#>  Objective Function Value:   -1350.314
#>  Parameter Estimates:        0.9691065 0.1635911 0.9212719 -1.72636
#>
#>  Objective Function Value:   -1350.242
#>  Parameter Estimates:        0.9680782 0.1858798 0.9460066 -1.737019
#>
#>  Objective Function Value:   -1350.242
#>  Parameter Estimates:        0.9680831 0.1858798 0.9460066 -1.737019
#>
#>  Objective Function Value:   -1350.242
#>  Parameter Estimates:        0.9680782 0.1858786 0.9460066 -1.737019
#>
#>  Objective Function Value:   -1350.242
#>  Parameter Estimates:        0.9680782 0.1858798 0.9460036 -1.737019
#>
#>  Objective Function Value:   -1350.242
#>  Parameter Estimates:        0.9680782 0.1858798 0.9460066 -1.73702
#>
#>  Objective Function Value:   -1350.078
#>  Parameter Estimates:        0.987342 0.1951129 0.9191215 -1.730379
#>
#>  Objective Function Value:   -1350.078
#>  Parameter Estimates:        0.9873395 0.1951129 0.9191215 -1.730379
#>
#>  Objective Function Value:   -1350.078
#>  Parameter Estimates:        0.987342 0.1951112 0.9191215 -1.730379
#>
#>  Objective Function Value:   -1350.078
#>  Parameter Estimates:        0.987342 0.1951129 0.9191232 -1.730379
#>
#>  Objective Function Value:   -1350.078
#>  Parameter Estimates:        0.987342 0.1951129 0.9191215 -1.730381
#>
#>  Objective Function Value:   -1350.274
#>  Parameter Estimates:        1.007734 0.1940269 0.9335209 -1.754851
#>
#>  Objective Function Value:   -1350.042
#>  Parameter Estimates:        0.9857484 0.1927684 0.9226369 -1.739619
#>
#>  Objective Function Value:   -1350.042
#>  Parameter Estimates:        0.9857512 0.1927684 0.9226369 -1.739619
#>
#>  Objective Function Value:   -1350.042
#>  Parameter Estimates:        0.9857484 0.1927707 0.9226369 -1.739619
#>
#>  Objective Function Value:   -1350.042
#>  Parameter Estimates:        0.9857484 0.1927684 0.922635 -1.739619
#>
#>  Objective Function Value:   -1350.042
#>  Parameter Estimates:        0.9857484 0.1927684 0.9226369 -1.739617
#>
#>  Objective Function Value:   -1350.012
#>  Parameter Estimates:        0.9901976 0.1984988 0.9296047 -1.737477
#>
#>  Objective Function Value:   -1350.012
#>  Parameter Estimates:        0.9902049 0.1984988 0.9296047 -1.737477
#>
#>  Objective Function Value:   -1350.012
#>  Parameter Estimates:        0.9901976 0.1984976 0.9296047 -1.737477
#>
#>  Objective Function Value:   -1350.012
#>  Parameter Estimates:        0.9901976 0.1984988 0.9295999 -1.737477
#>
#>  Objective Function Value:   -1350.012
#>  Parameter Estimates:        0.9901976 0.1984988 0.9296047 -1.737478
#>
#>  Objective Function Value:   -1349.999
#>  Parameter Estimates:        0.9988236 0.1999543 0.9334693 -1.74126
#>
#>  Objective Function Value:   -1349.999
#>  Parameter Estimates:        0.9988198 0.1999543 0.9334693 -1.74126
#>
#>  Objective Function Value:   -1349.999
#>  Parameter Estimates:        0.9988236 0.1999549 0.9334693 -1.74126
#>
#>  Objective Function Value:   -1349.999
#>  Parameter Estimates:        0.9988236 0.1999537 0.9334693 -1.74126
#>
#>  Objective Function Value:   -1349.999
#>  Parameter Estimates:        0.9988236 0.1999543 0.9334705 -1.74126
#>
#>  Objective Function Value:   -1349.999
#>  Parameter Estimates:        0.9988236 0.1999543 0.933468 -1.74126
#>
#>  Objective Function Value:   -1349.999
#>  Parameter Estimates:        0.9988236 0.1999543 0.9334693 -1.741259
#>
#>  Objective Function Value:   -1349.985
#>  Parameter Estimates:        1.002549 0.2080177 0.9315512 -1.746076
#>
#>  Objective Function Value:   -1349.985
#>  Parameter Estimates:        1.002553 0.2080177 0.9315512 -1.746076
#>
#>  Objective Function Value:   -1349.985
#>  Parameter Estimates:        1.002549 0.2080165 0.9315512 -1.746076
#>
#>  Objective Function Value:   -1349.985
#>  Parameter Estimates:        1.002549 0.2080177 0.9315484 -1.746076
#>
#>  Objective Function Value:   -1349.985
#>  Parameter Estimates:        1.002549 0.2080177 0.9315512 -1.746075
#>
#>  Objective Function Value:   -1349.985
#>  Parameter Estimates:        1.002549 0.2080177 0.9315512 -1.746076
#>
#>  Objective Function Value:   -1349.993
#>  Parameter Estimates:        0.9989379 0.2113539 0.939144 -1.750969
#>
#>  Objective Function Value:   -1349.981
#>  Parameter Estimates:        1.001175 0.2092873 0.9344407 -1.747938
#>
#>  Objective Function Value:   -1349.981
#>  Parameter Estimates:        1.001178 0.2092873 0.9344407 -1.747938
#>
#>  Objective Function Value:   -1349.981
#>  Parameter Estimates:        1.001175 0.2092861 0.9344407 -1.747938
#>
#>  Objective Function Value:   -1349.981
#>  Parameter Estimates:        1.001175 0.2092873 0.9344383 -1.747938
#>
#>  Objective Function Value:   -1349.981
#>  Parameter Estimates:        1.001175 0.2092873 0.9344407 -1.747937
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.0038 0.2116973 0.9336798 -1.749367
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.003798 0.2116973 0.9336798 -1.749367
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.0038 0.211698 0.9336798 -1.749367
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.0038 0.2116967 0.9336798 -1.749367
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.0038 0.2116973 0.933682 -1.749367
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.0038 0.2116973 0.9336777 -1.749367
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.0038 0.2116973 0.9336798 -1.749366
#>
#>  Objective Function Value:   -1349.979
#>  Parameter Estimates:        1.0038 0.2116973 0.9336798 -1.749368
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006235 0.2124718 0.9365982 -1.749888
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006241 0.2124718 0.9365982 -1.749888
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006229 0.2124718 0.9365982 -1.749888
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006235 0.2124734 0.9365982 -1.749888
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006235 0.2124702 0.9365982 -1.749888
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006235 0.2124718 0.9365965 -1.749888
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006235 0.2124718 0.9365982 -1.749886
#>
#>  Objective Function Value:   -1349.978
#>  Parameter Estimates:        1.006235 0.2124718 0.9365982 -1.749889
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009802 0.2131193 0.9380693 -1.750003
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009799 0.2131193 0.9380693 -1.750003
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009802 0.2131209 0.9380693 -1.750003
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009802 0.2131177 0.9380693 -1.750003
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009802 0.2131193 0.9380724 -1.750003
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009802 0.2131193 0.9380662 -1.750003
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009802 0.2131193 0.9380693 -1.750002
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.009802 0.2131193 0.9380693 -1.750003
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.01208 0.2150106 0.9395315 -1.752103
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.012087 0.2150106 0.9395315 -1.752103
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.012074 0.2150106 0.9395315 -1.752103
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.01208 0.2150117 0.9395315 -1.752103
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.01208 0.2150096 0.9395315 -1.752103
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.01208 0.2150106 0.9395341 -1.752103
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.01208 0.2150106 0.9395289 -1.752103
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.01208 0.2150106 0.9395315 -1.752102
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011464 0.2145723 0.9391637 -1.751617
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011498 0.2145723 0.9391637 -1.751617
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011429 0.2145723 0.9391637 -1.751617
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011464 0.2145753 0.9391637 -1.751617
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011464 0.2145694 0.9391637 -1.751617
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011464 0.2145723 0.9391771 -1.751617
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011464 0.2145723 0.9391504 -1.751617
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011464 0.2145723 0.9391637 -1.751616
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011464 0.2145723 0.9391637 -1.751619
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145678 0.9391594 -1.751614
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011505 0.2145678 0.9391594 -1.751614
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011408 0.2145678 0.9391594 -1.751614
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145922 0.9391594 -1.751614
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145434 0.9391594 -1.751614
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145678 0.9391935 -1.751614
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145678 0.9391253 -1.751614
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145678 0.9391594 -1.751594
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145678 0.9391594 -1.751634
#>
#>  Objective Function Value:   -1349.977
#>  Parameter Estimates:        1.011456 0.2145678 0.9391594 -1.751614
#>
#>  Objective Function Value:   -833.1119
#>  Parameter Estimates:        1.695972 0.3597793 0.5601027 -1.04464
#> Warning: NaNs produced

#>
#> Title:
#>  Normal Inverse Gaussian Parameter Estimation
#>
#> Call:
#>  .nigFit.mle(x = x, alpha = alpha, beta = beta, delta = delta,
#>     mu = mu, scale = scale, doplot = doplot, span = span, trace = trace,
#>     title = title, description = description)
#>
#> Model:
#>  Normal Inverse Gaussian Distribution
#>
#> Estimated Parameter(s):
#>      alpha       beta      delta         mu
#>  1.6959724  0.3597793  0.5601027 -1.0446402
#>