R Under development (unstable) (2024-02-26 r85990 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. > require("dse") Loading required package: dse Loading required package: tfplot Loading required package: tframe Attaching package: 'dse' The following objects are masked from 'package:stats': acf, simulate > Sys.info() sysname release version nodename machine "Windows" "Server x64" "build 20348" "CRANWIN3" "x86-64" login user effective_user "CRAN" "CRAN" "CRAN" > DSEversion() setRNG tframe dse "2024.2-1" "2015.12-1.1" "2024.2-2" > data("eg1.DSE.data.diff", package="dse") > > if (!is.TSdata(eg1.DSE.data.diff)) stop("Test data not found. Testing stopped.") > > fuzz.small <- 1e-14 > fuzz.large <- 1e-10 > digits <- 18 > all.ok <- TRUE > > > test.rng <- list(kind="Wichmann-Hill",seed=c(979,1479,1542),normal.kind="Box-Muller") > > VARmodel <- estVARXar(eg1.DSE.data.diff, re.add.means=FALSE, warn=FALSE) > > VARmodelB <- TSmodel(VARmodel) > B <- t(chol(VARmodel$estimates$cov)) > VARmodelB$B <- array(B, c(1,dim(B))) # has B != I > VARmodelB <- setTSmodelParameters(VARmodelB) > VARmodelB <- l(VARmodelB,VARmodel$data, warn=FALSE) > > cat("dse test 8a ...\n") dse test 8a ... > z <- simulate(TSmodel(VARmodel), input=inputData(eg1.DSE.data.diff)) > zz <- simulate(TSmodel(VARmodel), rng=setRNG::getRNG(z), + input=inputData(eg1.DSE.data.diff)) > ok <- testEqual(z, zz, fuzz=fuzz.small) > > if (!ok) + { + all.ok <- FALSE + } > > cat("dse test 8b ...\n") dse test 8b ... > sigma <- solve(t(VARmodelB$model$B[1,,]) %*% VARmodelB$model$B[1,,]) > sigma <- (sigma + t(sigma))/2 # insure symetric - chol is sensitive > zzz <- simulate(TSmodel(VARmodelB), rng=setRNG::getRNG(z), + input=inputData(eg1.DSE.data.diff), Cov=sigma) > ok <- testEqual(z, zzz, fuzz=fuzz.small) > error <- max(abs(outputData(z) - outputData(zzz))) > cat("max. error ", max(error), "\n") max. error 8.881784e-16 > > if (any(is.na(error)) || any(is.nan(error)) || fuzz.small < error || !ok) + {printTestValue(outputData(z), digits=18) + printTestValue(outputData(zzz), digits=18) + all.ok <- FALSE + } > > cat("dse test 8c ...\n") dse test 8c ... > # next use estimates$cov > z <- simulate(VARmodel, input=inputData(eg1.DSE.data.diff)) > sigma <- VARmodel$estimates$cov > sigma <- (sigma + t(sigma))/2 # insure symetric - chol is sensitive > zz <- simulate(TSmodel(VARmodel), rng=setRNG::getRNG(z), + input=inputData(eg1.DSE.data.diff), Cov=sigma) > > if ( ! testEqual(z, zz, fuzz=fuzz.small)) + { + all.ok <- FALSE + } > > ok <- testEqual(summary(z)$estimates, + summary(zz)$estimates, fuzz=fuzz.small) > > if ( !ok) + {printTestValue(c(summary(z)$estimates), digits=18) + printTestValue(c(summary(zz)$estimates), digits=18) + all.ok <- FALSE + } > > > > if (! all.ok) stop("some tests FAILED") > > > proc.time() user system elapsed 0.21 0.04 0.26