R Under development (unstable) (2024-01-31 r85845 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(fracdiff) > > set.seed(1) > ## examples(fdSperio) > mem.long <- fracdiff.sim(1500, d = 0.3) > spm <- fdSperio(mem.long$series) > str(spm, digits=6) List of 3 $ d : num 0.189757 $ sd.as : num 0.048145 $ sd.reg: num 0.0319748 > > set.seed(8) > ## examples(fdGPH) > mem.l2 <- fracdiff.sim(1024, d = 0.25) > fdGPH(mem.l2$series) $d [1] 0.2357737 $sd.as [1] 0.1346387 $sd.reg [1] 0.1209971 > > diffserie0 <- fracdiff:::diffseries0 # the old slow for()-loop one > stopifnot(exprs = { + all.equal(diffserie0(1:20, d = 1), c(-9.5, rep(1, 20-1)), tol = 1e-15) + all.equal(diffseries(1:20, d = 1), c(-9.5, rep(1, 20-1)), tol = 1e-13) # fft + all.equal(diffserie0(-10:10, d = 0), -10:10, tol = 1e-15) + all.equal(diffseries(-10:10, d = 0), -10:10, tol = 1e-13) + all.equal(diffserie0(-10:10, d = 1/2), + diffseries(-10:10, d = 1/2), tol = 1e-13) # see 4.3e-16 on 64b-Lnx + }) > > set.seed(123) > ## example(diffseries) > mem.l3 <- fracdiff.sim(80, d = 0.3) > mGPH <- fdGPH(mem.l3$series) > r0 <- diffserie0(mem.l3$series, d = mGPH$d) > r. <- diffseries(mem.l3$series, d = mGPH$d) > print(r0, digits = 4) [1] -0.761863 -0.648357 1.156142 0.254446 0.205702 1.790090 1.061263 [8] -0.727289 -0.711688 -0.641284 0.969069 0.581372 0.643513 0.406330 [15] -0.308041 1.804514 1.121691 -1.376291 0.516945 -0.296126 -1.079355 [22] -0.539937 -1.294863 -1.253349 -1.235765 -2.351131 -0.223510 -0.376664 [29] -1.579870 0.473816 0.201878 -0.440213 0.602163 0.889618 1.028929 [36] 1.031588 0.971153 0.386139 -0.015032 -0.256695 -0.707172 -0.421774 [43] -1.471215 1.610035 1.508302 -0.597359 -0.429911 -0.591076 0.550370 [50] 0.002532 0.255906 0.042294 -0.017154 1.366683 0.206105 1.723059 [57] -0.901849 0.538978 0.339388 0.422938 0.616481 -0.192038 -0.254046 [64] -1.031030 -1.378216 -0.226398 0.183380 -0.022056 0.848218 2.268592 [71] 0.286371 -1.954859 0.551967 -0.638054 -0.878345 0.681981 -0.196609 [78] -1.287879 -0.267172 -0.392858 > r <- all.equal(r0, r., tol = 0, countEQ = TRUE) # average rel.error, seen ~ 3.5e-16 > if(is.character(r) && as.numeric(sub(".*: ", '', r)) > 4e-15) + print(r) > stopifnot(all.equal(r0, r., tol = 1e-13)) > print(acf(r0)) # Autocorrelations of series 'r0', by lag 0 1 2 3 4 5 6 7 8 9 10 1.000 0.239 0.045 0.198 -0.051 -0.039 -0.024 -0.055 -0.093 -0.115 -0.084 11 12 13 14 15 16 17 18 19 -0.067 -0.197 -0.168 0.081 -0.068 -0.016 0.098 -0.061 -0.042 > mtext("(shouldn't show structure - ideally)") > > cat("Time used: ", proc.time(),"\n") # for ``statistical reasons'' Time used: 0.31 0.12 0.42 NA NA > > proc.time() user system elapsed 0.31 0.12 0.42