R Under development (unstable) (2025-07-10 r88399 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 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(longmemo) > > (H0 <- c(seq(0.5, .999, by = 1/32), 0.98, 0.99)) [1] 0.50000 0.53125 0.56250 0.59375 0.62500 0.65625 0.68750 0.71875 0.75000 [10] 0.78125 0.81250 0.84375 0.87500 0.90625 0.93750 0.96875 0.98000 0.99000 > > mform <- function(x, digits=6, wid=9) + formatC(x, flag="-", width=wid, digits=digits) > > options(width = 99) > .proctime00 <- proc.time() > > ## CetaARIMA(*) does NOT depend on H !! > hiH <- H0 >= 0.9375 > for(H in H0[!hiH]) { + cat("H=", mform(H,wid=7), + "; CetaFGN:", mform(CetaFGN (eta= c(H = H), m = 256)), + "; C.ARIMA(*,0,0):",mform(CetaARIMA(eta= c(H = H), m = 256, p=0,q=0)), + "\n") + } H= 0.5 ; CetaFGN: 0.433939 ; C.ARIMA(*,0,0): 0.716336 H= 0.53125 ; CetaFGN: 0.444391 ; C.ARIMA(*,0,0): 0.716336 H= 0.5625 ; CetaFGN: 0.453858 ; C.ARIMA(*,0,0): 0.716336 H= 0.59375 ; CetaFGN: 0.462444 ; C.ARIMA(*,0,0): 0.716336 H= 0.625 ; CetaFGN: 0.470243 ; C.ARIMA(*,0,0): 0.716336 H= 0.65625 ; CetaFGN: 0.477335 ; C.ARIMA(*,0,0): 0.716336 H= 0.6875 ; CetaFGN: 0.483795 ; C.ARIMA(*,0,0): 0.716336 H= 0.71875 ; CetaFGN: 0.489686 ; C.ARIMA(*,0,0): 0.716336 H= 0.75 ; CetaFGN: 0.495062 ; C.ARIMA(*,0,0): 0.716336 H= 0.78125 ; CetaFGN: 0.499972 ; C.ARIMA(*,0,0): 0.716336 H= 0.8125 ; CetaFGN: 0.504453 ; C.ARIMA(*,0,0): 0.716336 H= 0.84375 ; CetaFGN: 0.508528 ; C.ARIMA(*,0,0): 0.716336 H= 0.875 ; CetaFGN: 0.512195 ; C.ARIMA(*,0,0): 0.716336 H= 0.90625 ; CetaFGN: 0.515363 ; C.ARIMA(*,0,0): 0.716336 > ## Ignoring differences for 0.9375 and 0.99 : -- only just for --no-long-double case > ## IGNORE_RDIFF_BEGIN > for(H in H0[hiH]) { + cat("H=", mform(H,wid=7), + "; CetaFGN:", mform(CetaFGN (eta= c(H = H), m = 256)), + "; C.ARIMA(*,0,0):",mform(CetaARIMA(eta= c(H = H), m = 256, p=0,q=0)), + "\n") + } H= 0.9375 ; CetaFGN: 0.517558 ; C.ARIMA(*,0,0): 0.716336 H= 0.96875 ; CetaFGN: 0.514657 ; C.ARIMA(*,0,0): 0.716336 H= 0.98 ; CetaFGN: 0.504415 ; C.ARIMA(*,0,0): 0.716336 H= 0.99 ; CetaFGN: 0.454094 ; C.ARIMA(*,0,0): 0.716336 > ## IGNORE_RDIFF_END > > ems <- setNames(,6:18) > cFGN <- cT <- NA_real_ + ems > cARM <- array(NA, dim = c(3,3, length(ems)), dimnames = list(NULL, NULL, names(ems))) > for(em in ems) { ## oops -- becomes slow [specFGN() !] from about em = 13: + m <- 2^em; ch.m <- as.character(em) + cT[[ch.m]] <- system.time({ + cARM[ , , ch.m] <- CetaARIMA(eta = c(H = 0.7, phi=0.6, psi= -0.3), m = m, p=1,q=1) + cFGN[ ch.m] <- CetaFGN (eta = c(H = 0.7), m = m) + })[1] # user.time + cat("m= 2^",formatC(em, width = 2),": ", + " C_{FGN}= ", mform(cFGN[ch.m]), + "; C_{AR; 1,1}= ", mform(cARM[1,1,ch.m]), "\n", sep="") + if(interactive()) { + print(cARM[,,ch.m], digits = 6) ## .. for --no-long-double + cat("\n") + } + } m= 2^ 6: C_{FGN}= 0.601991 ; C_{AR; 1,1}= 48.3811 m= 2^ 7: C_{FGN}= 0.527591 ; C_{AR; 1,1}= 23.1023 m= 2^ 8: C_{FGN}= 0.486217 ; C_{AR; 1,1}= 14.489 m= 2^ 9: C_{FGN}= 0.462289 ; C_{AR; 1,1}= 10.8095 m= 2^10: C_{FGN}= 0.448197 ; C_{AR; 1,1}= 8.97598 m= 2^11: C_{FGN}= 0.439848 ; C_{AR; 1,1}= 7.97542 m= 2^12: C_{FGN}= 0.434909 ; C_{AR; 1,1}= 7.40081 m= 2^13: C_{FGN}= 0.432003 ; C_{AR; 1,1}= 7.06202 m= 2^14: C_{FGN}= 0.430305 ; C_{AR; 1,1}= 6.86006 m= 2^15: C_{FGN}= 0.429322 ; C_{AR; 1,1}= 6.7395 m= 2^16: C_{FGN}= 0.428757 ; C_{AR; 1,1}= 6.66781 m= 2^17: C_{FGN}= 0.428435 ; C_{AR; 1,1}= 6.62548 m= 2^18: C_{FGN}= 0.428253 ; C_{AR; 1,1}= 6.6007 > ## IGNORE_RDIFF_BEGIN > cat("Timings:\n"); print(cT) Timings: 6 7 8 9 10 11 12 13 14 15 16 17 18 0.00 0.00 0.00 0.00 0.00 0.02 0.00 0.03 0.05 0.09 0.20 0.38 0.74 > (dcFGN <- diff(cFGN)) 7 8 9 10 11 12 13 -0.0743999825 -0.0413739690 -0.0239271717 -0.0140926857 -0.0083488315 -0.0049390320 -0.0029060916 14 15 16 17 18 -0.0016973329 -0.0009832959 -0.0005649833 -0.0003220787 -0.0001822580 > cA.18 <- matrix(c(6.6007, -6.55447, 0.133132, + -6.55447, 11.2902, -5.43864, + 0.133132, -5.43864, 6.80152), 3L) > all.equal(cA.18, cARM[,,"18"], tolerance = 0) # ~ 9.376e-7 [1] "Mean relative difference: 9.376691e-07" > (dcAdiffs <- apply(cARM[,,] - c(cA.18), 3, norm)) 6 7 8 9 10 11 12 7.972731e+01 3.174852e+01 1.525424e+01 8.166784e+00 4.620208e+00 2.678818e+00 1.561267e+00 13 14 15 16 17 18 9.011411e-01 5.070730e-01 2.715407e-01 1.313591e-01 4.852472e-02 3.424027e-05 > (mnD <- mean(abs(tail(cFGN, 3) - 0.42825))) # 0.0002317033 [1] 0.0002317033 > ## IGNORE_RDIFF_END > stopifnot(exprs = { + -0.075 < dcFGN ; dcFGN < 0 + mnD < 4e-4 + all.equal(cA.18, cARM[,,"18"], tolerance = 4e-6) + tail(dcAdiffs, 5) < c(0.51, 0.28, 0.14, 0.05, 4e-5) + diff(dcAdiffs) < 0 + }) > > ## Last Line: > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 1.92 0.19 2.11 NA NA > > proc.time() user system elapsed 2.09 0.25 2.32