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) > library(methods) > options(warn = 2L, error = if (interactive()) recover) > > o.1 <- egf_cache( "egf-1.rds") > o.1p <- egf_cache("profile-egf-1.rds") > > > ## object ############################################################## > > stopifnot(exprs = { + is.list(o.1p) + identical(oldClass(o.1p), c("profile.egf", "profile")) + length(o.1p) == 1L + identical(names(o.1p), "log(r), A, window_01") + identical(dim(o.1p), c(1L, 1L)) + identical(dimnames(o.1p), list("A, window_01", "log(r)")) + + is.list(o.1p[[1L]]) + identical(oldClass(o.1p[[1L]]), "data.frame") + length(o.1p[[1L]]) == 2L + identical(names(o.1p[[1L]]), c("z", "par.vals")) + + is.double(z <- o.1p[[1L]][["z"]]) + !is.matrix(z) + min(abs(z)) == 0 + prod(sign(range(z))) == -1 + + is.double(par.vals <- o.1p[[1L]][["par.vals"]]) + is.matrix(par.vals) + ncol(par.vals) == 1L # for now + !is.unsorted(par.vals, strictly = TRUE) + par.vals[which.min(abs(z))] == coef(o.1)[1L] + + is.factor (attr(o.1p, "top" )) + is.factor (attr(o.1p, "ts" )) + is.factor (attr(o.1p, "window")) + is.data.frame(attr(o.1p, "frame" )) + is (attr(o.1p, "A" ), "dgCMatrix") + is.double (attr(o.1p, "par" )) + identical (attr(o.1p, "level" ), 0.95) + }) > > > ## confint ############################################################# > > o.1pc <- confint(o.1p, level = 0.95, class = TRUE) > n <- length(o.1p) > > stopifnot(exprs = { + is.list(o.1pc) + identical(oldClass(o.1pc), c("confint.egf", "data.frame")) + length(o.1pc) == 5L + identical(names(o.1pc), c("top", "ts", "window", "value", "ci")) + + all(vapply(o.1pc[c("top", "ts", "window")], is.factor, FALSE)) + all(vapply(o.1pc[c("value", "ci" )], is.double, FALSE)) + + is.vector(o.1pc[["value"]]) + is.matrix(o.1pc[["ci"]]) + identical(dim(o.1pc[["ci"]]), c(1L, 2L)) + identical(dimnames(o.1pc[["ci"]]), list(NULL, c("2.5 %", "97.5 %"))) + all(o.1pc[["ci"]][, 1L] < o.1pc[["value"]]) + all(o.1pc[["ci"]][, 2L] > o.1pc[["value"]]) + }) > > > ## parallel ############################################################ > > f <- + function(method, cores) + profile(o.1, A = NULL, + 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.1p, f("multicore", if (windows) 1L else 2L)) + all.equal(o.1p, f("snow", 2L)) + }) 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 starting worker pid=31756 on localhost:11803 at 23:08:50.898 starting worker pid=20212 on localhost:11803 at 23:08:50.900 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 > > > ## plot ################################################################ > > plot(o.1p, type = "z^2", bty = "u", las = 1) > > proc.time() user system elapsed 10.68 0.23 22.42