R Under development (unstable) (2026-01-19 r89308 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(mbbefd) Loading required package: fitdistrplus Loading required package: MASS Loading required package: survival Loading required package: alabama Loading required package: numDeriv Loading required package: Rcpp Package: mbbefd Version: 0.8.14 Date: BugReport: https://github.com/spedygiorgio/mbbefd/issues > > #test of shifted truncated pareto distribution > n <- 1e1 > > x <- rstpareto(n, 2)+0.01 > y <- rstpareto(n, 2) > > #test CDF > z <- 0:4/4 > ecdf(x)(z) [1] 0.0 0.2 0.8 1.0 1.0 > > #test EC > f <- function(d) + mean(pmin(x, d))/mean(x) > rval <- Vectorize(f, "d") > > cbind(eecf(x)(x), rval(x)) [,1] [,2] [1,] 0.3572086 0.3572086 [2,] 0.9425130 0.9425130 [3,] 0.5234137 0.5234137 [4,] 0.9086646 0.9086646 [5,] 0.6983353 0.6983353 [6,] 1.0000000 1.0000000 [7,] 0.8856063 0.8856063 [8,] 0.9759676 0.9759676 [9,] 0.7052785 0.7052785 [10,] 0.7516154 0.7516154 > cbind(eecf(x)(z), rval(z)) [,1] [,2] [1,] 0.0000000 0.0000000 [2,] 0.6691433 0.6691433 [3,] 0.9749031 0.9749031 [4,] 1.0000000 1.0000000 [5,] 1.0000000 1.0000000 > > class(eecf(x)) [1] "eecf" "function" > class(ecdf(x)) [1] "ecdf" "stepfun" "function" > > print(eecf(x)) Empirical Exposure Curve Function Call: eecf(x) x[1:10] = 0.12334, 0.1871, 0.2626, ..., 0.50184, 0.58482 > print(ecdf(x)) Empirical CDF Call: ecdf(x) x[1:10] = 0.12334, 0.1871, 0.2626, ..., 0.50184, 0.58482 > > cbind(eecf(x)(sort(x)), + environment(eecf(x))$"Gx") [,1] [,2] [1,] 0.3572086 0.3572086 [2,] 0.5234137 0.5234137 [3,] 0.6983353 0.6983353 [4,] 0.7052785 0.7052785 [5,] 0.7516154 0.7516154 [6,] 0.8856063 0.8856063 [7,] 0.9086646 0.9086646 [8,] 0.9425130 0.9425130 [9,] 0.9759676 0.9759676 [10,] 1.0000000 1.0000000 > > print(summary(eecf(x))) Empirical Exposure Curve Function: 10 unique values with summary Min. 1st Qu. Median Mean 3rd Qu. Max. 0.1233 0.2635 0.3390 0.3453 0.4343 0.5848 > print(summary(ecdf(x))) Empirical CDF: 10 unique values with summary Min. 1st Qu. Median Mean 3rd Qu. Max. 0.1233 0.2635 0.3390 0.3453 0.4343 0.5848 > > plot(eecf(x)) > plot(ecdf(x)) > > > plot(eecf(x)) > plot(eecf(y), add=TRUE, col="red") > lines(eecf(y[1:5]), col="green") > > ?plot.eecf > ?summary.eecf > > proc.time() user system elapsed 1.92 0.40 2.29