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. > library(nor1mix) > > ## Check nM2par(), par2norMix() and llnorMix() : > > nms <- paste("MW.nm", 1:16, sep="") > for(n in nms) { + cat(n,":") + obj <- get(n, envir = as.environment("package:nor1mix")) + xx <- rnorMix(1000, obj) + logLik.x <- sum(dnorMix(xx, obj, log = TRUE)) + pp <- nM2par(obj) # use "current default" + pp.l <- nM2par(obj, trafo = "logit") + pp.c <- nM2par(obj, trafo = "clr1") + nm <- par2norMix(pp) # (current) default + nm.l <- par2norMix(pp.l, trafo= "logit") + nm.c <- par2norMix(pp.c, trafo= "clr1") + stopifnot(exprs = { + all.equal(pp, nM2par(nm), tol= 1e-15) + all.equal(pp.l, nM2par(nm.l, trafo= "logit"), tol= 1e-15) + all.equal(pp.c, nM2par(nm.c, trafo= "clr1"), tol= 1e-15) + all.equal(obj, nm, check.attributes=FALSE, tol=4e-15) + all.equal(obj, nm.l, check.attributes=FALSE, tol=4e-15) + all.equal(obj, nm.c, check.attributes=FALSE, tol=4e-15) + ## xx + all.equal(llnorMix(pp , xx), logLik.x, tol = 1e-15) + all.equal(llnorMix(pp.l, xx, trafo= "logit"), logLik.x, tol = 1e-15) + all.equal(llnorMix(pp.c, xx, trafo= "clr1"), logLik.x, tol = 1e-15) + }) + cat(" [ok]\n") + } MW.nm1 : [ok] MW.nm2 : [ok] MW.nm3 : [ok] MW.nm4 : [ok] MW.nm5 : [ok] MW.nm6 : [ok] MW.nm7 : [ok] MW.nm8 : [ok] MW.nm9 : [ok] MW.nm10 : [ok] MW.nm11 : [ok] MW.nm12 : [ok] MW.nm13 : [ok] MW.nm14 : [ok] MW.nm15 : [ok] MW.nm16 : [ok] > > proc.time() user system elapsed 0.17 0.07 0.23