[R] Fitting data using Generalized Pareto Distribution

Rui Barradas ruipbarradas at sapo.pt
Sun Nov 27 22:26:07 CET 2016


Hello,

Why quantile(train, 0.9) ?  If you use quantile(train) it seems to fit 
the data much better. You haven't posted a data example so I've made up one.


library(eva)  # needed for rgpd()
library(extRemes)

set.seed(1)
train <- rgpd(1e3, scale = 0.9, shape = -0.4)
thresh90 <- quantile(train)
model <- fevd(train,threshold =thresh90,type="GP")
model

x <- seq(0, 3, length.out = 1e3)

hist(train, prob = TRUE)
lines(x, dgpd(x, scale = 0.7595442, shape = -0.3707967), col = "red")


Hope this helps,

Rui Barradas

Em 27-11-2016 16:01, TicoR escreveu:
> Let the train be the data set consisting of numbers that I need to fit.
> Code is as follows:
> library(extRemes)
> thresh90 <- quantile(train, 0.90)
> model<-fevd(train,threshold =thresh90,type="GP")
>
> Model returns the following :
> Negative Log-Likelihood Value:  317.7561
>
>
>   Estimated parameters:
>       scale      shape
>   0.8858284 -0.3596079
>
>   Standard Error Estimates:
>       scale      shape
> 0.04377744 0.03194536
>
>   Estimated parameter covariance matrix.
>               scale        shape
> scale  0.001916464 -0.001236952
> shape -0.001236952  0.001020506
>
>
>
> On Sun, Nov 27, 2016 at 9:08 PM, Rui Barradas <ruipbarradas at sapo.pt
> <mailto:ruipbarradas at sapo.pt>> wrote:
>
>     Hello,
>
>     Please provide us with a reproducible example. A data exampla would
>     be nice and some working code, the code you are using to fit the data.
>
>     Rui Barradas
>
>
>     Em 27-11-2016 15:04, TicoR escreveu:
>
>         I am trying to fit some data using Generalized Pareto
>         Distribution in R
>         using extRemes
>         package(https://cran.r-project.org/web/packages/extRemes
>         <https://cran.r-project.org/web/packages/extRemes>) I
>         am able to get the parameters for the distribution. How would I
>         get the
>         simulated values for the model using the parameters?
>
>                  [[alternative HTML version deleted]]
>
>         ______________________________________________
>         R-help at r-project.org <mailto:R-help at r-project.org> mailing list
>         -- To UNSUBSCRIBE and more, see
>         https://stat.ethz.ch/mailman/listinfo/r-help
>         <https://stat.ethz.ch/mailman/listinfo/r-help>
>         PLEASE do read the posting guide
>         http://www.R-project.org/posting-guide.html
>         <http://www.R-project.org/posting-guide.html>
>         and provide commented, minimal, self-contained, reproducible code.
>
>



More information about the R-help mailing list