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 > > > ##### > # (1) simulation > > n <- 100 > x <- dataRTDE(simu.nb=n, simu.marg="ufrechet", simu.cop="indep") > print(x) dataRTDE object: head number of points 100 [,1] [,2] [1,] 1.7041119 1.5303166 [2,] 0.3090939 0.6744062 [3,] 0.4077636 0.6004342 [4,] 0.2610420 0.7273595 [5,] 1.3401891 1.0636038 [6,] 2.2291828 1.9523477 > summary(x) dataRTDE object: summary number of points 100 [,1] [,2] Min. 0.1647484 0.3016615 1st Qu. 0.7122960 0.7484197 Median 1.3856225 1.3717056 Mean 4.2071657 28.7405228 3rd Qu. 3.0017848 5.8035213 Max. 99.1172305 2243.0290929 > plot(x, xlab="x", ylab="y") > plot(x, xlab="x", ylab="y", which=2) > > n <- 100 > y <- dataRTDE(simu.nb=n, simu.marg="ufrechet", simu.cop="indep", contamin.eps=1/100, + contamin.method="max+", contamin.marg="ufrechet", contamin.cop="indep") > print(y) dataRTDE object: head number of points 100 [,1] [,2] [1,] 0.4437854 1.2702478 [2,] 1.4977426 6.5637504 [3,] 0.6324202 2.5258000 [4,] 0.1248401 1.5307619 [5,] 2.7186294 0.3484793 [6,] 0.9187879 2.1079694 number of contaminations 1 [,1] [,2] [1,] 671.9873 138.1244 > summary(y) dataRTDE object: summary number of points 100 [,1] [,2] Min. 0.1248401 0.1717854 1st Qu. 0.6627429 0.6921558 Median 1.2146822 1.3246003 Mean 9.7149331 8.3580402 3rd Qu. 2.4168959 4.2208126 Max. 667.7716453 137.7409457 number of contaminations 1 [,1] [,2] [1,] 671.9873 138.1244 > > plot(y, xlab="x", ylab="y") > legend("right", pch=21, col=c("black", "red"), leg=c("orig", "cont")) > > plot(y, xlab="x", ylab="y", which=2) > legend("right", pch=21, col=c("black", "red"), leg=c("orig", "cont")) > > > ##### > # (2) part of the workers' compensation dataset > > x1 <- c( + 21.798086, 22.640528, 22.572010, 24.789710, 25.876764, 28.033613, + 22.525887, 12.004031, 12.713178, 13.596610, 14.811727, 12.774073, + 20.245789, 24.242468, 50.216515, 56.099793, 58.109747, 67.807105, + 73.852437, 84.208474, 83.604216, 19.507341, 20.810822, 23.838122, + 24.212193, 25.367578, 35.401344, 37.580989, 12.428727, 13.492474, + 13.303600, 13.228920, 14.060473, 15.227696, 17.857683, 6.829432, + 6.219655, 5.696577, 4.542884, 3.663628, 2.632086, 1.932376, + 3.724269, 4.149906, 3.696872, 0.487892, 0.594629, 0.560057, + 0.724571, 2.494260, 3.394857, 3.314038, 10.595191, 12.863955, + 2.789484, 2.426480, 3.140245, 3.964679, 4.899610, 5.247896, + 6.280799, 7.721616, 9.324806, 30.035148, 32.618878, 36.071278, + 42.494763, 49.524793, 48.872610, 40.636397, 211.719199, 232.681695, + 230.007534, 234.635378, 251.852677, 207.512194, 215.038202, 22.525133, + 23.545828, 24.979337, 27.390359, 27.337832, 28.268401, 25.281128, + 11.939588, 10.566079, 19.387104, 23.062327, 23.089131, 23.799825, + 21.317594, 28.171269, 32.008767, 31.300733, 33.507831, 32.207902, + 23.471988, 24.101833, 24.766193, 26.078216) > > x2 <- c( + 0.538707, 0.439184, 1.059775, 0.560013, 1.004997, 1.097314, 0.609833, 0.270222, + 0.229566, 0.596850, 0.196539, 0.134248, 0.489312, 0.418218, 0.769208, 0.649707, + 0.503919, 0.675466, 0.545745, 1.562266, 0.931762, 0.291125, 0.499927, 0.151084, + 0.141910, 0.300373, 0.119761, 0.141300, 0.377662, 0.169574, 0.243585, 0.061215, + 0.055272, 0.312816, 0.160196, 0.623029, 0.280707, 0.174422, 0.176666, 0.153907, + 0.101874, 0.000000, 0.000000, 0.018082, 0.408802, 0.010500, 0.000000, 0.000000, + 0.037500, 0.011234, 0.042146, 0.086599, 0.041500, 0.115592, 0.000000, 0.170623, + 0.078436, 0.047501, 0.051499, 0.144621, 0.008998, 0.259875, 0.548369, 0.383658, + 0.420764, 0.588094, 0.717523, 1.133547, 1.372065, 0.601273, 2.140846, 2.382040, + 2.929906, 3.165114, 3.595126, 4.284873, 2.739517, 0.389158, 0.374650, 0.684493, + 0.143933, 1.236701, 0.734178, 0.850133, 0.348156, 0.331977, 0.116060, 0.266805, + 0.310604, 0.278189, 0.079680, 1.238292, 0.576512, 0.831404, 1.303705, 0.673907, + 0.605122, 0.664457, 0.348918, 0.370878) > > obs <- dataRTDE(cbind(x1, x2)) > obs dataRTDE object: head number of points 100 x1 x2 [1,] 21.79809 0.538707 [2,] 22.64053 0.439184 [3,] 22.57201 1.059775 [4,] 24.78971 0.560013 [5,] 25.87676 1.004997 [6,] 28.03361 1.097314 > summary(obs) dataRTDE object: summary number of points 100 x1 x2 Min. 0.487892 0.0000000 1st Qu. 8.924008 0.1417575 Median 22.548949 0.3598980 Mean 35.945586 0.5911339 3rd Qu. 31.477742 0.6668195 Max. 251.852677 4.2848730 > > plot(obs) > > obs <- dataRTDE(cbind(x1, x2), contamin.eps=2/100, + contamin.method="max+", contamin.marg="ufrechet", contamin.cop="indep") > obs dataRTDE object: head number of points 100 x1 x2 [1,] 21.79809 0.538707 [2,] 22.64053 0.439184 [3,] 22.57201 1.059775 [4,] 24.78971 0.560013 [5,] 25.87676 1.004997 [6,] 28.03361 1.097314 number of contaminations 2 [,1] [,2] [1,] 253.204062 252.59939 [2,] 5.679455 13.70284 > summary(obs) dataRTDE object: summary number of points 100 x1 x2 Min. 0.487892 0.0000000 1st Qu. 8.924008 0.1417575 Median 22.548949 0.3598980 Mean 35.945586 0.5911339 3rd Qu. 31.477742 0.6668195 Max. 251.852677 4.2848730 number of contaminations 2 [,1] [,2] Min. 5.679455 13.70284 1st Qu. 67.560607 73.42698 Median 129.441758 133.15112 Mean 129.441758 133.15112 3rd Qu. 191.322910 192.87525 Max. 253.204062 252.59939 > > plot(obs) > > plot(obs, which=2) > > proc.time() user system elapsed 0.29 0.06 0.36