kappacvd.fit | R Documentation |
Maximum-likelihood fitting for the Kappa distribution,
including generalized linear modelling of each parameter. The function differs from
kappad.fit
because it uses a different parametrisation of the distribution based on
the \tau
, the ratio of the scale parameter and the location parameter. This means that when regression models are applied for the location,
these also affect the scale.
The function allows any parameter to be kept fixed and to not be estimated.
kappacvd.fit(
xdat,
ydat = NULL,
mul = NULL,
taul = NULL,
shl = NULL,
sh2l = NULL,
mulink = identity,
taulink = identity,
shlink = identity,
sh2link = identity,
muinit = NULL,
tauinit = NULL,
shinit = NULL,
sh2init = NULL,
show = TRUE,
method = "Nelder-Mead",
optimPars = NULL,
maxit = 10000,
fixedPars = list(mu = NULL, sig = NULL, sh = NULL, sh2 = NULL),
...
)
xdat |
A numeric vector of data to be fitted |
ydat |
A matrix of covariates for generalized linear modelling of the parameters (or NULL (the default) for stationary fitting). The number of rows should be the same as the length of xdat |
mul |
Numeric vectors of integers, giving the columns of ydat that contain covariates for generalized linear modelling of the location parameter (or NULL (the default) if the corresponding parameter is stationary) |
taul |
As |
shl |
As |
sh2l |
As |
mulink |
the link function for the location parameter - default to identity |
taulink |
the link function for the tau parameter - default to identity |
shlink |
the link function for the shape parameter - default to identity |
sh2link |
the link function for the second shape parameter - default to identity |
muinit |
initial values for the location parameter |
tauinit |
initial values for the tau parameter |
shinit |
initial values for the shape parameter |
sh2init |
initial values for the second shape parameter |
show |
Logical; if |
method |
The optimization method (see |
optimPars |
A string with other parameters to pass into |
maxit |
The maximum number of iterations |
fixedPars |
a named list to fix any of the distribution parameter to a given value. When the named parameter is set to |
... |
Other control parameters for the optimization. These are passed to components of the control argument of optim. |
An object of the kappacv.fit class - with values which mirror the ones of the gev.fit class in ismev
.
In the output the vals
matrix gives the location and scale values obtained as scale = \tau
* location.
Hosking, J.R.M. and Wallis, J.R., 2005. Regional frequency analysis: an approach based on L-moments. Cambridge university press.
kappad.fit
set.seed(12)
x <- runif(120)
y <- rkappa(120,loc = 40+3*x,
scale = 0.2*(40+3*x), sh = -0.2, sh2=-0.4)
fit1 <- kappacvd.fit(y, show=FALSE)
fit1
## now add a regression model for the location
fit2 <- kappacvd.fit(y, ydat = cbind(x), mul=1, show=FALSE)
fit2
## now a fit with a fixed shape parameter
fitf2 <- kappacvd.fit(y, show=FALSE, fixedPars = list(sh2 = -0.4))
fitf2 ## only three parameters are estimated
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.