Fits a generalized Pareto distribution (gPd) to a random sample using either the asymptotic maximum likelihood method (amle) or the combined estimation method (Villasenor-Alva and Gonzalez-Estrada, 2009).
gp_fit(x, method)
a numeric data vector containing a random sample of positive real numbers.
a character string giving the name of the parameter estimation method to be used. There are two available methods: "combined"
and "amle"
. Use "combined"
for fitting a gPd with negative shape parameter. Use "amle"
for fitting a gPd with non-negative shape parameter.
Parameter estimates.
The distribution function of the gPd is provided in the details section of the gp_test function
.
Villasenor-Alva, J.A. and Gonzalez-Estrada, E. (2009). A bootstrap goodness of fit test for the generalized Pareto distribution. Computational Statistics and Data Analysis,53,11,3835-3841. http://dx.doi.org/10.1016/j.csda.2009.04.001
gp_test
for testing the gPd hypothesis.
# NOT RUN {
# Example 1: fitting a gPd to the excesses above the threshold 0.165 ppm of the ozone
# levels provided in the o3 data set.
data(o3)
o3levels <- o3$ozone_level - 0.165 # ozone levels minus the threshold 0.165 ppm
gp_fit(o3levels, method = "combined") # fitting the gPd using the "combined" method
# Example 2: fitting a gPd to a simulated data set from the uniform distribution,
# which is a gPd with shape parameter = -1 and scale parameter = 1.
x <- runif(100) # simulating a uniform random sample
gp_fit(x, "combined") # fitting a gPd to x using the "combined" method
# }
Run the code above in your browser using DataLab