Learn R Programming

extremefit (version 1.0.2)

predict.hill.adapt: Predict the adaptive survival or quantile function

Description

Give the adaptive survival function or quantile function

Usage

# S3 method for hill.adapt
predict(object, newdata = NULL, type = "quantile",
  input = NULL, ...)

Arguments

object

output object of the function hill.adapt.

newdata

optionally, a data frame or a vector with which to predict. If omitted, the original data points are used.

type

either "quantile" or "survival".

input

optionnaly, the name of the variable to estimate.

...

further arguments passed to or from other methods.

Value

The function provide the quantile assiociated to the adaptive model for the probability grid (transformed to -log(1-p) in the output) if type = "quantile". And the survival function assiociated to the adaptive model for the quantile grid if type = "survival".

Details

If type = "quantile", \(newdata\) must be between 0 and 1. If type = "survival", \(newdata\) must be in the domain of the data from the hill.adapt function. If \(newdata\) is a data frame, the variable from which to predict must be the first one or its name must start with a "p" if type = "quantile" and "x" if type = "survival". The name of the variable from which to predict can also be written as \(input\).

References

Durrieu, G. and Grama, I. and Jaunatre, K. and Pham, Q.-K. and Tricot, J.-M. (2018). extremefit: A Package for Extreme Quantiles. Journal of Statistical Software, 87, 1--20.

See Also

hill.adapt

Examples

Run this code
# NOT RUN {
x <- rparetoCP(1000)

HH <- hill.adapt(x, weights=rep(1, length(x)), initprop = 0.1,
               gridlen = 100 , r1 = 0.25, r2 = 0.05, CritVal=10)

newdata <- probgrid(p1 = 0.01, p2 = 0.999, length = 100)
pred.quantile <- predict(HH, newdata, type = "quantile")
newdata <- seq(0, 50, 0.1)
pred.survival <- predict(HH, newdata, type = "survival")#survival function

#compare the theorical quantile and the adaptive one.
predict(HH, 0.9999, type = "quantile")
qparetoCP(0.9999)

#compare the theorical probability and the adaptive one assiociated to a quantile.
predict(HH, 20, type = "survival")
1 - pparetoCP(20)

# }

Run the code above in your browser using DataLab