Coerce a gev.fit
object from the ismev package into a
NSGEV
object.
# S3 method for gev.fit
as.NSGEV(x, data, ...)
The object to be coerced.
The matrix of covariates that was used.
Not used yet.
An object with class "NSGEV"
.
A gev.fit
object does not embed the set of covariates
used nor a even a call. Thus the set of covariates must be given.
To be compliant with NSGEV
, this data set must be a data frame
or a matrix with colnames.
require(ismev)
## number of observations and covariates
n <- 20; m <- 4
## generate a matrix covariates
set.seed(1234)
dat <- matrix(runif(n * m), nrow = n)
colnames(dat) <- rNames(m)
## response
y <- drop(nieve::rGEV(n))
## fit
fit <- gev.fit(xdat = y, ## response
ydat = dat, ## matrix of covariates
mul = 1:2, sigl = 4, ## indices of covariates
shl = NULL,
mulink = exp) ## optional inverse-link
#> Warning: NaNs produced
#> $model
#> $model[[1]]
#> [1] 1 2
#>
#> $model[[2]]
#> [1] 4
#>
#> $model[[3]]
#> NULL
#>
#>
#> $link
#> [1] "c(exp, identity, identity)"
#>
#> $conv
#> [1] 0
#>
#> $nllh
#> [1] 30.22914
#>
#> $mle
#> [1] -13.0806888 3.6753455 -6.1078553 1.2954442 -0.5832947 0.4902082
#>
#> $se
#> [1] NaN NaN NaN 0.3880493 0.5333207 0.5098481
#>
## coerce
ns <- as.NSGEV(fit, data = dat)