R Under development (unstable) (2024-10-16 r87241 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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.12 Date: BugReport: https://github.com/spedygiorgio/mbbefd/issues > > #test of beta distribution > n <- 1e4 > > x <- roibeta(n, 2, 2, p1=0) > y <- roibeta(n, 4/3, 2/3, p1=0) > > #test CDF > z <- 0:10/10 > cbind(ecdf(x)(z), poibeta(z, 2, 2, 0)) [,1] [,2] [1,] 0.0000 0.000 [2,] 0.0285 0.028 [3,] 0.1011 0.104 [4,] 0.2162 0.216 [5,] 0.3534 0.352 [6,] 0.4973 0.500 [7,] 0.6439 0.648 [8,] 0.7821 0.784 [9,] 0.8942 0.896 [10,] 0.9749 0.972 [11,] 1.0000 1.000 > > cbind(ecdf(y)(z), poibeta(z, 4/3, 2/3, 0)) [,1] [,2] [1,] 0.0000 0.00000000 [2,] 0.0282 0.02936482 [3,] 0.0716 0.07560159 [4,] 0.1261 0.13290373 [5,] 0.1948 0.20018980 [6,] 0.2786 0.27757936 [7,] 0.3642 0.36608701 [8,] 0.4683 0.46791349 [9,] 0.5821 0.58758551 [10,] 0.7259 0.73638534 [11,] 1.0000 1.00000000 > > #total loss > c(etl(x), tloibeta(2, 2, 0)) [1] 0 0 > c(etl(y), tloibeta(4/3, 2/3, 0)) [1] 0 0 > > #mean > c(mean(x), moibeta(1, 2, 2, 0)) [1] 0.5008605 0.5000000 > c(mean(y), moibeta(1, 4/3, 2/3, 0)) [1] 0.6701241 0.6666667 > > > #test EC > cbind(eecf(x)(z), ecoibeta(z, 2, 2, 0)) [,1] [,2] [1,] 0.0000000 0.0000 [2,] 0.1976967 0.1981 [3,] 0.3848733 0.3856 [4,] 0.5533975 0.5541 [5,] 0.6966744 0.6976 [6,] 0.8113806 0.8125 [7,] 0.8972736 0.8976 [8,] 0.9544473 0.9541 [9,] 0.9859122 0.9856 [10,] 0.9982462 0.9981 [11,] 1.0000000 1.0000 > cbind(eecf(y)(z), ecoibeta(z, 4/3, 2/3, 0)) [,1] [,2] [1,] 0.0000000 0.0000000 [2,] 0.1474771 0.1481237 [3,] 0.2894513 0.2904043 [4,] 0.4241343 0.4248943 [5,] 0.5497007 0.5500358 [6,] 0.6637238 0.6643336 [7,] 0.7651253 0.7662079 [8,] 0.8523936 0.8538450 [9,] 0.9232756 0.9249505 [10,] 0.9751598 0.9761506 [11,] 1.0000000 1.0000000 > > > > #plots > n <- 1e5 > n <- 1e2 > x <- roibeta(n, 2, 2, p1=0) > y <- roibeta(n, 4/3, 2/3, p1=0) > > > plot(eecf(x), do.points=FALSE) > v <- seq(0, 1, length=101) > lines(v, ecoibeta(v, 2, 2, 0), lty=3, col="red") > > > plot(eecf(y), do.points=FALSE) > v <- seq(0, 1, length=101) > lines(v, ecoibeta(v, 4/3, 2/3, 0), lty=3, col="red") > > > proc.time() user system elapsed 1.50 0.23 1.71