R Under development (unstable) (2024-04-23 r86473 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(epigrowthfit) > options(warn = 2L, error = if (interactive()) recover) > > .S3method("all.equal", "confint.egf", + function(target, current, ignore = NULL, ...) { + if (!is.null(ignore)) + attributes(target)[ignore] <- attributes(current)[ignore] <- + NULL + NextMethod() + }) > > o.1 <- egf_cache( "egf-1.rds") > o.1c.w <- egf_cache("confint-egf-1.rds") # confint(method = "wald") Classes 'confint.egf' and 'data.frame': 40 obs. of 5 variables: $ top : Factor w/ 2 levels "log(r)","log(c0)": 1 1 1 1 1 1 1 1 1 1 ... $ ts : Factor w/ 10 levels "A","B","C","D",..: 1 1 2 2 3 3 4 4 5 5 ... $ window: Factor w/ 20 levels "window_01","window_02",..: 1 2 3 4 5 6 7 8 9 10 ... $ value : num -3.21 -3 -3.23 -3 -2.98 ... $ ci : num [1:40, 1:2] -3.49 -3.21 -3.48 -3.27 -3.3 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : NULL .. ..$ : chr [1:2] "2.5 %" "97.5 %" - attr(*, "level")= num 0.95 Profile value: 1032.019 Profile value: 1032.051 Profile value: 1032.317 Profile value: 1032.555 Profile value: 1032.7 Profile value: 1032.863 Profile value: 1032.951 Profile value: 1033.042 Profile value: 1033.138 Profile value: 1033.238 Profile value: 1033.342 Profile value: 1033.45 Profile value: 1033.562 Profile value: 1033.677 Profile value: 1033.796 Profile value: 1033.918 Profile value: 1034.043 Profile value: 1032.019 Profile value: 1032.05 Profile value: 1032.28 Profile value: 1032.469 Profile value: 1032.58 Profile value: 1032.701 Profile value: 1032.831 Profile value: 1032.971 Profile value: 1033.119 Profile value: 1033.274 Profile value: 1033.437 Profile value: 1033.521 Profile value: 1033.607 Profile value: 1033.694 Profile value: 1033.782 Profile value: 1033.873 Profile value: 1033.964 > o.1c.p <- egf_cache("confint-egf-2.rds") # confint(method = "profile") > o.1c.u <- egf_cache("confint-egf-3.rds") # confint(method = "uniroot") > o.1f <- egf_cache( "fitted-egf-1.rds") Classes 'fitted.egf' and 'data.frame': 40 obs. of 5 variables: $ top : Factor w/ 2 levels "log(r)","log(c0)": 1 1 1 1 1 1 1 1 1 1 ... $ ts : Factor w/ 10 levels "A","B","C","D",..: 1 1 2 2 3 3 4 4 5 5 ... $ window: Factor w/ 20 levels "window_01","window_02",..: 1 2 3 4 5 6 7 8 9 10 ... $ value : num -3.21 -3 -3.23 -3 -2.98 ... $ se : num 0.147 0.106 0.127 0.14 0.162 ... - attr(*, "se")= logi TRUE - attr(*, "ns")= int 20 - attr(*, "nt")= int 2 > o.1p <- egf_cache("profile-egf-1.rds") Profile value: 1032.019 Profile value: 1032.051 Profile value: 1032.317 Profile value: 1032.555 Profile value: 1032.7 Profile value: 1032.863 Profile value: 1032.951 Profile value: 1033.042 Profile value: 1033.138 Profile value: 1033.238 Profile value: 1033.342 Profile value: 1033.45 Profile value: 1033.562 Profile value: 1033.677 Profile value: 1033.796 Profile value: 1033.918 Profile value: 1034.043 Profile value: 1032.019 Profile value: 1032.05 Profile value: 1032.28 Profile value: 1032.469 Profile value: 1032.58 Profile value: 1032.701 Profile value: 1032.831 Profile value: 1032.971 Profile value: 1033.119 Profile value: 1033.274 Profile value: 1033.437 Profile value: 1033.521 Profile value: 1033.607 Profile value: 1033.694 Profile value: 1033.782 Profile value: 1033.873 Profile value: 1033.964 List of 1 $ log(r), A, window_01:'data.frame': 33 obs. of 2 variables: ..$ z : num [1:33] -1.97 -1.93 -1.88 -1.83 -1.78 ... ..$ par.vals: num [1:33, 1] -3.25 -3.24 -3.24 -3.23 -3.23 ... - attr(*, "dim")= int [1:2] 1 1 - attr(*, "dimnames")=List of 2 ..$ : chr "A, window_01" ..$ : chr "log(r)" - attr(*, "top")= Factor w/ 2 levels "log(r)","log(c0)": 1 - attr(*, "ts")= Factor w/ 10 levels "A","B","C","D",..: 1 - attr(*, "window")= Factor w/ 20 levels "window_01","window_02",..: 1 - attr(*, "frame")='data.frame': 1 obs. of 0 variables - attr(*, "A")=Formal class 'dgCMatrix' [package "Matrix"] with 6 slots .. ..@ i : int 0 .. ..@ p : int [1:7] 0 0 1 1 1 1 1 .. ..@ Dim : int [1:2] 1 6 .. ..@ Dimnames:List of 2 .. .. ..$ : NULL .. .. ..$ : NULL .. ..@ x : num 1 .. ..@ factors : list() - attr(*, "par")= 'coef.egf' num [1:5] -3.1028 6.4264 -1.7744 -0.5563 -0.0442 ..- attr(*, "len")= Named int [1:2] 2 3 .. ..- attr(*, "names")= chr [1:2] "beta" "theta" ..- attr(*, "map")=List of 2 .. ..$ beta : NULL .. ..$ theta: NULL - attr(*, "level")= num 0.95 - attr(*, "class")= chr [1:2] "profile.egf" "profile" > > > ## object ############################################################## > > o.1fc <- confint(o.1f, class = TRUE) > o.1pc <- confint(o.1p, class = TRUE) > > stopifnot(exprs = { + is.list(o.1c.w) + identical(oldClass(o.1c.w), c("confint.egf", "data.frame")) + all.equal(o.1c.w, o.1fc) + + is.list(o.1c.p) + identical(oldClass(o.1c.p), c("confint.egf", "data.frame")) + all.equal(o.1c.p, o.1pc) + + is.list(o.1c.u) + identical(oldClass(o.1c.u), c("confint.egf", "data.frame")) + all.equal(o.1c.u, o.1c.p, tolerance = 5e-06) + }) > > > ## parallel ############################################################ > > f <- + function(method, cores) + confint(o.1, A = NULL, method = "uniroot", class = TRUE, + top = "log(r)", subset = quote(country == "A" & wave == 1), + parallel = egf_parallel(method = method, cores = cores)) > > windows <- .Platform[["OS.type"]] == "windows" > stopifnot(exprs = { + all.equal(o.1c.u, f("multicore", if (windows) 1L else 2L)) + all.equal(o.1c.u, f("snow", 2L)) + }) starting worker pid=171740 on localhost:11775 at 23:05:21.863 starting worker pid=191432 on localhost:11775 at 23:05:21.895 > > > ## plot ################################################################ > > op <- par(mar = c(4.5, 4, 2, 1), oma = c(0, 0, 0, 0)) > plot(o.1c.w) > par(op) > > proc.time() user system elapsed 39.06 0.71 50.67