Predicted Values based on a fevd
Object
predict.fevd.Rd
This method computes the parameters of the marginal
distribution (GP
or GEV
) for the response. This
marginal distribution depends on the covariates used in
`object`, the values of which are to be given in
newdata
.
Usage
# S3 method for fevd
predict(object, newdata = NULL, level = 0.99, threshold = NULL, trace = 1, ...)
Arguments
- object
An object with class
"fevd"
representing a non-stationary POT model, either Poisson-GP (type = "GP"
) or NHPP (type = "PP"
).- newdata
A data frame containing the covariates.
- level
Confidence level.
- threshold
The threshold. This can be either a suitable vector of an object representing a quantile regression, inheriting from
"rq"
.- trace
Integer level of verbosity.
- ...
Not used yet
Value
A matrix with its rows matching those of newdata
and its columns matching the parameters of the marginal distribution, Generalized Pareto (GP) or Generalized Extreme-Value (GEV).
Caution
This method is highly experimental since the
extRemes::fevd
package does not store all all the
information required to make the prediction. The vector of
coefficients for a covariate-dependent threshold is not
stored.
Examples
## use centimetres as precipitation unit
data(Fort)
Fort <- within(Fort, Prec <- 2.54 * Prec)
tau <- 0.97; u0 <- quantile(Fort$Prec, prob = tau)
fit0 <- fevd(x = Prec, data = Fort, threshold = u0, type = "GP")
p0 <- predict(fit0)
rq <- rq(Prec ~ cos(2 * pi * tobs / 365.25) + sin(2 * pi * tobs / 365.25),
data = Fort, tau = tau)
summary(rq)
#>
#> Call: rq(formula = Prec ~ cos(2 * pi * tobs/365.25) + sin(2 * pi *
#> tobs/365.25), tau = tau, data = Fort)
#>
#> tau: [1] 0.97
#>
#> Coefficients:
#> Value Std. Error t value Pr(>|t|)
#> (Intercept) 0.96776 0.02542 38.07484 0.00000
#> cos(2 * pi * tobs/365.25) -0.60217 0.03264 -18.44866 0.00000
#> sin(2 * pi * tobs/365.25) 0.09192 0.02930 3.13736 0.00171
## compute the threshold and extract the fitted coefficients
u <- predict(rq, newdata = Fort)
beta_u <- coef(rq)
fit1 <- fevd(x = Prec, data = Fort, type = "GP",
scale.fun = ~ cos(2 * pi * tobs / 365.25) + sin(2 * pi * tobs / 365.25),
threshold = beta_u,
threshold.fun = ~ cos(2 * pi * tobs / 365.25) + sin(2 * pi * tobs / 365.25))
p1 <- predict(fit1)
#> Error in eval(object$call$threshold): object 'beta_u' not found