R version 4.4.0 alpha (2024-04-04 r86334 ucrt) 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. > ### Since we had an undetected bug in rnorMix()... > > ## These are defined as norMix() calls in ../R/zMarrWand-dens.R > library("nor1mix") > n1Env <- as.environment("package:nor1mix") > nms <- ls(pat="^MW.nm", envir = n1Env) > nms <- nms[order(as.numeric(substring(nms,6)))] # warning <== "MW.nm2.old" Warning message: In order(as.numeric(substring(nms, 6))) : NAs introduced by coercion > > set.seed(123) > for(n in nms) { + o <- n1Env[[n]] + cat("\n",n,":\n"); print(o) + ro4 <- rnorMix(4, o) + if(nchar(sub("^MW.nm", "", n)) == 1) { # the first MW.nm do not show diffs + cat("4 random X from", n,":") + print(ro4) + } + + ## Testing of sort.norMix(): + if(is.unsorted(o[,"mu"])) + o <- sort(o) + ae <- all.equal(o, sort(o), tolerance = 4e-16) # non-stable sorting, MW. + if(!isTRUE(ae)) { + cat("sort(o) differs from o:\n"); print(ae) + } + } MW.nm1 : 'Normal Mixture' object ``#1 Gaussian'' mu sigma w [1,] 0 1 1 4 random X from MW.nm1 :[1] 1.55870831 -0.56047565 -0.23017749 0.07050839 MW.nm2 : 'Normal Mixture' object ``#2 Skewed'' mu sigma w [1,] 0.000000 1.0000000 0.2 [2,] 0.500000 0.6666667 0.2 [3,] 1.083333 0.5555556 0.6 4 random X from MW.nm2 :[1] -1.2650612 1.7633788 0.8357433 0.0420981 MW.nm3 : 'Normal Mixture' object ``#3 Str Skew'' mu sigma w [1,] 0.000000 1.00000000 0.125 [2,] -1.000000 0.66666667 0.125 [3,] -1.666667 0.44444444 0.125 [4,] -2.111111 0.29629630 0.125 [5,] -2.407407 0.19753086 0.125 [6,] -2.604938 0.13168724 0.125 [7,] -2.736626 0.08779150 0.125 [8,] -2.824417 0.05852766 0.125 4 random X from MW.nm3 :[1] -2.2688680 -2.7958750 -0.6680997 -2.6671989 MW.nm4 : 'Normal Mixture' object ``#4 Kurtotic'' mu sigma w [1,] 0 1.0 0.6666667 [2,] 0 0.1 0.3333333 4 random X from MW.nm4 :[1] -1.6866933 -0.6250393 -0.7288912 0.8377870 MW.nm5 : 'Normal Mixture' object ``#5 Outlier'' mu sigma w [1,] 0 1.0 0.1 [2,] 0 0.1 0.9 4 random X from MW.nm5 :[1] 0.08951257 0.04264642 -0.02950715 0.08781335 MW.nm6 : 'Normal Mixture' object ``#6 Bimodal'' mu sigma w [1,] -1 0.6666667 0.5 [2,] 1 0.6666667 0.5 4 random X from MW.nm6 :[1] -1.5145278 -0.8089676 0.1863253 -3.1515486 MW.nm7 : 'Normal Mixture' object ``#7 Separated'' mu sigma w [1,] -1.5 0.5 0.5 [2,] 1.5 0.5 0.5 4 random X from MW.nm7 :[1] 1.2985576 -0.4155220 0.9384457 -0.8960190 MW.nm8 : 'Normal Mixture' object ``#8 Asym Bim'' mu sigma w [1,] 0.0 1.0000000 0.75 [2,] 1.5 0.3333333 0.25 4 random X from MW.nm8 :[1] 1.68987252 1.90946426 -0.43212979 0.02884391 MW.nm9 : 'Normal Mixture' object ``#9 Trimodal'' mu sigma w [1,] -1.2 0.60 0.45 [2,] 1.2 0.60 0.45 [3,] 0.0 0.25 0.10 4 random X from MW.nm9 :[1] 1.0549861 2.2115323 -0.2260785 0.5579591 MW.nm10 : 'Normal Mixture' object ``#10 Claw'' mu sigma w [1,] 0.0 1.0 0.5 [2,] -1.0 0.1 0.1 [3,] -0.5 0.1 0.1 [4,] 0.0 0.1 0.1 [5,] 0.5 0.1 0.1 [6,] 1.0 0.1 0.1 MW.nm11 : 'Normal Mixture' object ``#11 Doub Claw'' mu sigma w [1,] -1.0 0.6666667 0.490000000 [2,] 1.0 0.6666667 0.490000000 [3,] -1.5 0.0100000 0.002857143 [4,] -1.0 0.0100000 0.002857143 [5,] -0.5 0.0100000 0.002857143 [6,] 0.0 0.0100000 0.002857143 [7,] 0.5 0.0100000 0.002857143 [8,] 1.0 0.0100000 0.002857143 [9,] 1.5 0.0100000 0.002857143 MW.nm12 : 'Normal Mixture' object ``#12 Asym Claw'' mu sigma w [1,] 0.0 1.000 0.50000000 [2,] -1.5 0.400 0.25806452 [3,] -0.5 0.200 0.12903226 [4,] 0.5 0.100 0.06451613 [5,] 1.5 0.050 0.03225806 [6,] 2.5 0.025 0.01612903 MW.nm13 : 'Normal Mixture' object ``#13 As Do Claw'' mu sigma w [1,] -1.0 0.6666667 0.460000000 [2,] 1.0 0.6666667 0.460000000 [3,] -1.5 0.0100000 0.003333333 [4,] -1.0 0.0100000 0.003333333 [5,] -0.5 0.0100000 0.003333333 [6,] 0.5 0.0700000 0.023333333 [7,] 1.0 0.0700000 0.023333333 [8,] 1.5 0.0700000 0.023333333 MW.nm14 : 'Normal Mixture' object ``#14 Smoo Comb'' mu sigma w [1,] -1.4761905 0.50793651 0.50793651 [2,] 0.8095238 0.25396825 0.25396825 [3,] 1.9523810 0.12698413 0.12698413 [4,] 2.5238095 0.06349206 0.06349206 [5,] 2.8095238 0.03174603 0.03174603 [6,] 2.9523810 0.01587302 0.01587302 MW.nm15 : 'Normal Mixture' object ``#15 Disc Comb'' mu sigma w [1,] -2.1428571 0.28571429 0.28571429 [2,] -0.4285714 0.28571429 0.28571429 [3,] 1.2857143 0.28571429 0.28571429 [4,] 2.2857143 0.04761905 0.04761905 [5,] 2.5714286 0.04761905 0.04761905 [6,] 2.8571429 0.04761905 0.04761905 MW.nm16 : 'Normal Mixture' object ``#16 Dist Bim'' mu sigma w [1,] -2.5 0.1666667 0.5 [2,] 2.5 0.1666667 0.5 MW.nm2.old : 'Normal Mixture' object ``#2 Skewed (old)'' mu sigma w [1,] -0.3 1.2000000 0.2 [2,] 0.3 0.8000000 0.2 [3,] 1.0 0.6666667 0.6 > > proc.time() user system elapsed 0.14 0.06 0.18