GNG_fit {mistr} | R Documentation |
Fitting a GPD-Normal-GPD Model
Description
GNG_fit
is used to fit three components composite models with components GPD, normal and GPD.
Usage
GNG_fit(
data,
start = c(break1 = -0.02, break2 = 0.02, mean = 0, sd = 0.0115, shape1 = 0.15, shape2
= 0.15),
break_fix = FALSE,
midd = mean(data),
...
)
Arguments
data |
vector of values to which the density is optimized. |
start |
named vector (break1, break2, mean, sd, shape1, shape2) of values that are used to start the optimization, default: c(break1 = -0.02, break2 = 0.02, mean = 0, sd = 0.0115, shape1 = 0.15,shape2 = 0.15). |
break_fix |
logical, fix the breakpoints at the values from start?, default: FALSE. |
midd |
split reals into two subintervals, the first breakpoint is then optimized on the left of |
... |
further arguments to be passed to the optimizer. |
Details
The GNG model is the GPD-Normal-GPD model. This means
that a -X
transformation of a GPD random variable will be used for the left tail,
normal distribution for the center and again GPD for the right tail.
The code uses the maximum likelihood estimation technique to estimate the six parameters from the start vector
(break1, break2, mean, sd, shape1, shape2
). The other parameters (location and scale parameters of the GPD) are
computed in each step such that the function is continuous. Weights are estimated in every step as a proportion
of points that correspond to each of the truncated region. If the breakpoints are fixed (i.e. break_fix = TRUE
),
the weights are computed before the optimization procedure.
Optimization is handled by the mle2
function.
Value
A list of class comp_fit.
See Also
Examples
## Not run:
GNG_fit(stocks$SAP)
GNG_fit(stocks$MSFT)
autoplot(GNG_fit(stocks$ADS))
GNG_fit(stocks$GSPC, start = c(break1=-0.0075, break2=0.0075, mean=0,
sd=0.0115, shape1=0.15, shape2=0.15), control = list(maxit = 20000))
GNG_fit(stocks$DJI, start = c(break1=-0.0055, break2=0.0055, mean=-0.001,
sd=0.0055,shape1=0.15,shape2=0.15), method = "CG",control = list(maxit = 1000))
## End(Not run)