R Under development (unstable) (2024-10-15 r87238 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(RTDE) Loading required package: parallel > > # ?EPD > > ##### > # (1) density function > x <- seq(0, 5, length=24) > > cbind(x, dEPD(x, 1/2, 1/4, -1)) x [1,] 0.0000000 0.000000e+00 [2,] 0.2173913 -1.930799e+01 [3,] 0.4347826 -1.642687e+05 [4,] 0.6521739 4.562695e+01 [5,] 0.8695652 6.186917e+00 [6,] 1.0869565 2.032956e+00 [7,] 1.3043478 9.380732e-01 [8,] 1.5217391 5.174295e-01 [9,] 1.7391304 3.185337e-01 [10,] 1.9565217 2.112457e-01 [11,] 2.1739130 1.478507e-01 [12,] 2.3913043 1.078003e-01 [13,] 2.6086957 8.116773e-02 [14,] 2.8260870 6.272437e-02 [15,] 3.0434783 4.952410e-02 [16,] 3.2608696 3.981453e-02 [17,] 3.4782609 3.250593e-02 [18,] 3.6956522 2.689492e-02 [19,] 3.9130435 2.251292e-02 [20,] 4.1304348 1.903918e-02 [21,] 4.3478261 1.624883e-02 [22,] 4.5652174 1.398095e-02 [23,] 4.7826087 1.211821e-02 [24,] 5.0000000 1.057366e-02 > > ##### > # (2) distribution function > > cbind(x, pEPD(x, 1/2, 1/4, -1, lower=FALSE)) x [1,] 0.0000000 1.00000000 [2,] 0.2173913 1.00000000 [3,] 0.4347826 1.00000000 [4,] 0.6521739 1.00000000 [5,] 0.8695652 1.00000000 [6,] 1.0869565 0.78495778 [7,] 1.3043478 0.48307926 [8,] 1.5217391 0.33109783 [9,] 1.7391304 0.24262646 [10,] 1.9565217 0.18613164 [11,] 2.1739130 0.14765726 [12,] 2.3913043 0.12018031 [13,] 2.6086957 0.09982576 [14,] 2.8260870 0.08430175 [15,] 3.0434783 0.07217710 [16,] 3.2608696 0.06251812 [17,] 3.4782609 0.05469335 [18,] 3.6956522 0.04826264 [19,] 3.9130435 0.04291120 [20,] 4.1304348 0.03840883 [21,] 4.3478261 0.03458392 [22,] 4.5652174 0.03130636 [23,] 4.7826087 0.02847596 [24,] 5.0000000 0.02601457 > cbind(x, pEPD(x, 1/2, 1/4, -1)) x [1,] 0.0000000 0.0000000 [2,] 0.2173913 0.0000000 [3,] 0.4347826 0.0000000 [4,] 0.6521739 0.0000000 [5,] 0.8695652 0.0000000 [6,] 1.0869565 0.2150422 [7,] 1.3043478 0.5169207 [8,] 1.5217391 0.6689022 [9,] 1.7391304 0.7573735 [10,] 1.9565217 0.8138684 [11,] 2.1739130 0.8523427 [12,] 2.3913043 0.8798197 [13,] 2.6086957 0.9001742 [14,] 2.8260870 0.9156982 [15,] 3.0434783 0.9278229 [16,] 3.2608696 0.9374819 [17,] 3.4782609 0.9453066 [18,] 3.6956522 0.9517374 [19,] 3.9130435 0.9570888 [20,] 4.1304348 0.9615912 [21,] 4.3478261 0.9654161 [22,] 4.5652174 0.9686936 [23,] 4.7826087 0.9715240 [24,] 5.0000000 0.9739854 > > ##### > # (3) quantile function > > qEPD(1/2, 1/2, 1/4, -1) [1] 1.286796 > qEPD(1:10/11, 1/2, 1/4, -1) [1] 1.032712 1.071149 1.117116 1.173311 1.243979 1.336263 1.463325 1.652884 [9] 1.977314 2.726650 > cbind(x, qEPD(pEPD(x, 1/2, 1/4, -1), 1/2, 1/4, -1)) #first five lines should be different x [1,] 0.0000000 1.000000 [2,] 0.2173913 1.000000 [3,] 0.4347826 1.000000 [4,] 0.6521739 1.000000 [5,] 0.8695652 1.000000 [6,] 1.0869565 1.086957 [7,] 1.3043478 1.304348 [8,] 1.5217391 1.521739 [9,] 1.7391304 1.739130 [10,] 1.9565217 1.956522 [11,] 2.1739130 2.173913 [12,] 2.3913043 2.391304 [13,] 2.6086957 2.608696 [14,] 2.8260870 2.826087 [15,] 3.0434783 3.043478 [16,] 3.2608696 3.260870 [17,] 3.4782609 3.478261 [18,] 3.6956522 3.695652 [19,] 3.9130435 3.913043 [20,] 4.1304348 4.130435 [21,] 4.3478261 4.347826 [22,] 4.5652174 4.565217 [23,] 4.7826087 4.782609 [24,] 5.0000000 5.000000 > > > x <- seq(1, 10, length=21) > cbind(x, qEPD(pEPD(x, 1/2, 1/4, -1), 1/2, 1/4, -1)) x [1,] 1.00 1.00 [2,] 1.45 1.45 [3,] 1.90 1.90 [4,] 2.35 2.35 [5,] 2.80 2.80 [6,] 3.25 3.25 [7,] 3.70 3.70 [8,] 4.15 4.15 [9,] 4.60 4.60 [10,] 5.05 5.05 [11,] 5.50 5.50 [12,] 5.95 5.95 [13,] 6.40 6.40 [14,] 6.85 6.85 [15,] 7.30 7.30 [16,] 7.75 7.75 [17,] 8.20 8.20 [18,] 8.65 8.65 [19,] 9.10 9.10 [20,] 9.55 9.55 [21,] 10.00 10.00 > > system.time(x <- qEPD(1:10000/10001, 1/2, 1/4, -1)) user system elapsed 0.88 0.00 0.87 > head(x) [1] 1.000033 1.000067 1.000100 1.000133 1.000167 1.000200 > tail(x) [1] 32.66762 35.78447 40.00700 46.19466 56.57491 80.00650 > > > proc.time() user system elapsed 1.14 0.06 1.18