R Under development (unstable) (2024-12-17 r87446 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.13 Date: BugReport: https://github.com/spedygiorgio/mbbefd/issues > > #test of GB1 distribution > > #integral of the improper density > integrate(doigbeta, 0, 1, shape0=1, shape1=3, shape2=3/2, p1=1/3) 0.6666667 with absolute error < 2.2e-09 > integrate(doigbeta, 0, 1, shape0=1/2, shape1=3, shape2=3/2, p1=1/3) 0.6666668 with absolute error < 0.00011 > integrate(doigbeta, 0, 1, shape0=2, shape1=3, shape2=3/2, p1=2/3) 0.3333333 with absolute error < 7.9e-09 > > > #RNG > n <- 1e4 > x <- roigbeta(n, shape0=2, shape1=3, shape2=3/2, p1=1/3) > y <- roigbeta(n, shape0=pi, shape1=3, shape2=3/2, p1=2/3) > > c(etl(x), tloigbeta(shape0=2, shape1=3, shape2=3/2, p1=1/3)) [1] 0.3397000 0.3333333 > c(etl(y), tloigbeta(shape0=pi, shape1=3, shape2=3/2, p1=2/3)) [1] 0.6660000 0.6666667 > > #test CDF > z <- 0:10/10 > cbind(ecdf(x)(z), poigbeta(z, shape0=2, shape1=3, shape2=3/2, p1=1/3)) [,1] [,2] [1,] 0.0000 0.000000e+00 [2,] 0.0000 1.452854e-06 [3,] 0.0002 9.192194e-05 [4,] 0.0010 1.026573e-03 [5,] 0.0057 5.602627e-03 [6,] 0.0201 2.053053e-02 [7,] 0.0588 5.806933e-02 [8,] 0.1377 1.360844e-01 [9,] 0.2791 2.738347e-01 [10,] 0.4759 4.764485e-01 [11,] 1.0000 1.000000e+00 > cbind(ecdf(y)(z), poigbeta(z, shape0=pi, shape1=3, shape2=3/2, p1=2/3)) [,1] [,2] [1,] 0.0000 0.000000e+00 [2,] 0.0000 2.741140e-10 [3,] 0.0000 1.879965e-07 [4,] 0.0001 8.532368e-06 [5,] 0.0001 1.267565e-04 [6,] 0.0014 1.014773e-03 [7,] 0.0069 5.449682e-03 [8,] 0.0220 2.196019e-02 [9,] 0.0698 7.034267e-02 [10,] 0.1796 1.815272e-01 [11,] 1.0000 1.000000e+00 > > > #mean > c(mean(x), moigbeta(1, shape0=2, shape1=3, shape2=3/2, p1=1/3)) [1] 0.8699166 0.8702266 > c(mean(y), moigbeta(1, shape0=pi, shape1=3, shape2=3/2, p1=2/3)) [1] 0.9558747 0.9560429 > > #raw moment > for(i in 2:4) + { + cat("E(X^", i, ")\n", sep="") + print(c(mean(x^i), moigbeta(i, shape0=2, shape1=3, shape2=3/2, p1=1/3))) + print(c(mean(y^i), moigbeta(i, shape0=pi, shape1=3, shape2=3/2, p1=2/3))) + } E(X^2) [1] 0.7773966 0.7777778 [1] 0.9207844 0.9209865 E(X^3) [1] 0.7088720 0.7091586 [1] 0.8922962 0.8924923 E(X^4) [1] 0.6564802 0.6565657 [1] 0.8687711 0.8689576 > > > #test EC > cbind(eecf(x)(z), ecoigbeta(z, shape0=2, shape1=3, shape2=3/2, p1=1/3)) [,1] [,2] [1,] 0.0000000 0.0000000 [2,] 0.1149535 0.1149126 [3,] 0.2298987 0.2298222 [4,] 0.3448066 0.3446868 [5,] 0.4594260 0.4592770 [6,] 0.5730821 0.5728352 [7,] 0.6838702 0.6835254 [8,] 0.7879348 0.7877674 [9,] 0.8796892 0.8797731 [10,] 0.9516952 0.9521039 [11,] 1.0000000 1.0000000 > > cbind(eecf(y)(z), ecoigbeta(z, shape0=pi, shape1=3, shape2=3/2, p1=2/3)) [,1] [,2] [1,] 0.0000000 0.0000000 [2,] 0.1046162 0.1045978 [3,] 0.2092324 0.2091956 [4,] 0.3138464 0.3137932 [5,] 0.4184521 0.4183862 [6,] 0.5230061 0.5229376 [7,] 0.6272700 0.6272522 [8,] 0.7305299 0.7305856 [9,] 0.8306840 0.8307599 [10,] 0.9229444 0.9228566 [11,] 1.0000000 1.0000000 > > > > > > proc.time() user system elapsed 1.70 0.26 1.96