fgkg(x, phiul = TRUE, phiur = TRUE, pvector = NULL,
add.jitter = FALSE, factor = 0.1, amount = NULL,
std.err = TRUE, method = "BFGS",
control = list(maxit = 10000), finitelik = TRUE, ...)
nmean
, nsd
, u
,
sigmau
, xi
) or NULL
jitter
jitter
optim
)optim
)optim
call
: optim
call
x
: (jittered) data vector x
kerncentres
: actual kernel centres used
x
init
: pvector
optim
: complete optim
output
mle
: vector of MLE of parameters
cov
: variance of MLE parameters
se
:
standard error of MLE parameters
nllh
:
minimum negative cross-validation log-likelihood
allparams
: vector of MLE of model parameters,
including phiul
and phiur
allse
:
vector of standard error of all parameters,
including phiul
and phiur
n
: total sample size
lambda
: MLE of
bandwidth
ul
: lower threshold
sigmaul
: MLE of lower tail GPD scale
xil
: MLE of lower tail GPD shape
phiul
: MLE of lower tail fraction
ur
: upper threshold
sigmaur
: MLE of upper tail GPD scale
xir
: MLE of
upper tail GPD shape
phiur
: MLE of upper
tail fraction
}
The output list has some duplicate entries and repeats
some of the inputs to both provide similar items to those
from fpot
and to make it as
useable as possible.x
only) has been included in the fitting inputs, using the
jitter
function, to remove the
ties. The default options red in the
jitter
are specified above,
but the user can override these. Notice the default
scaling factor=0.1
, which is a tenth of the
default value in the jitter
function itself.
A warning message is given if the data appear to be
rounded (i.e. more than 5 estimated bandwidth is too small, then data rounding is
the likely culprit. Only use the jittering when the MLE
of the bandwidth is far too small.phiul=TRUE
so
that the tail fraction is specified by normal
distribution $\phi_u = 1 - mean(H(ul))$. When
phiul=FALSE
then the tail fraction is treated as
an extra parameter estimated using the MLE which is the
sample proportion below the threshold ul
. In this
case the standard error for phiu
is estimated and
output as sephiu
.
Missing values (NA
and NaN
) are assumed to
be invalid data so are ignored, which is inconsistent
with the evd
library which
assumes the missing values are below the threshold.
The default optimisation algorithm is "BFGS", which
requires a finite negative log-likelihood function
evaluation finitelik=TRUE
. For invalid parameters,
a zero likelihood is replaced with exp(-1e6)
. The
"BFGS" optimisation algorithms require finite values for
likelihood, so any user input for finitelik
will
be overridden and set to finitelik=TRUE
if either
of these optimisation methods is chosen.
It will display a warning for non-zero convergence result
comes from optim
function
call.
If the hessian is of reduced rank then the variance (from
inverse hessian) and standard error of bandwidth
parameter cannot be calculated, then by default
std.err=TRUE
and the function will stop. If you
want the bandwidth estimate even if the hessian is of
reduced rank (e.g. in a simulation study) then set
std.err=FALSE
.fkdengpd
,
fkden
,
jitter
,
density
and
bw.nrd0
Other gkg: dgkg
, gkg
,
lgkg
, nlgkg
,
pgkg
, qgkg
,
rgkg
x = rnorm(1000, 0, 1)
fit = fgkg(x, phiul = FALSE, phiur = FALSE, std.err = FALSE)
hist(x, 100, freq = FALSE, xlim = c(-5, 5))
xx = seq(-5, 5, 0.01)
lines(xx, dgkg(xx, x, fit$lambda, fit$ul, fit$sigmaul, fit$xil, fit$phiul,
fit$ur, fit$sigmaur, fit$xir, fit$phiur), col="blue")
abline(v = fit$ul)
abline(v = fit$ur)
Run the code above in your browser using DataLab