diff --git a/.Rbuildignore b/.Rbuildignore index 7a15f7d..d4cfa59 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ notes.org ^cran-comments\.md$ ^CRAN-RELEASE$ ^\.github$ +^CRAN-SUBMISSION$ diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..ba17be5 --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 1.0.0 +Date: 2024-03-20 01:40:54 UTC +SHA: dbb09ef6eae8689c3cc8a16aa9dcbdcdc6589db8 diff --git a/DESCRIPTION b/DESCRIPTION index ce5cbec..f8312f8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,8 @@ Encoding: UTF-8 LazyData: true Imports: stats, - Formula + Formula, + withr Suggests: spelling, ggplot2, diff --git a/R/Cbound.R b/R/Cbound.R index f922725..072db87 100644 --- a/R/Cbound.R +++ b/R/Cbound.R @@ -101,31 +101,32 @@ RDSmoothnessBound <- function(object, s, separate=FALSE, multiple=TRUE, hatM <- function(D) { ts <- abs(D[1, ]/D[2, ]) # sup_t statistic maxt <- D[, which.max(ts)] - set.seed(42) + Z <- matrix(stats::rnorm(10000*ncol(D)), ncol=ncol(D)) ## median unbiased point estimate and lower CI - hatM <- lower <- 0 + hatm <- lower <- 0 if (max(ts) > cv(0, Z, D[2, ], 1/2)) { - hatM <- FindZero(function(m) max(ts)-cv(m, Z, D[2, ], 1/2), + hatm <- FindZero(function(m) max(ts)-cv(m, Z, D[2, ], 1/2), negative=FALSE) } if (max(ts) >= cv(0, Z, D[2, ], alpha)) { lower <- FindZero(function(m) max(ts)-cv(m, Z, D[2, ], alpha), negative=FALSE) } - list(estimate=hatM, conf.low=lower, + list(estimate=hatm, conf.low=lower, diagnostics=c(Delta=maxt[1], sdDelta=maxt[2], y1=maxt[3], y2=maxt[4], y3=maxt[5], I1=maxt[6:7], I2=maxt[8:9], I3=maxt[10:11])) } if (separate) { - po <- hatM(Dp) - ne <- hatM(Dm) + withr::with_seed(42, po <- hatM(Dp)) + withr::with_seed(42, ne <- hatM(Dm)) ret <- data.frame(rbind("Below cutoff"=unlist(ne[1:2]), "Above cutoff"=unlist(po[1:2]))) } else { - ret <- data.frame((hatM(cbind(Dm, Dp))[1:2])) + ret <- withr::with_seed(42, + data.frame((hatM(cbind(Dm, Dp))[1:2]))) rownames(ret) <- c("Pooled") } ret diff --git a/cran-comments.md b/cran-comments.md index 788ed31..9cd4951 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,11 @@ +## Resubmission +This is a resubmission. In this version I have: + +* avoided using set.seed() inside a function (in R/Cbound.R). Instead, I use + withr::with_seed() to ensure that the results are reproducible without + modifying the global environment. + + ## Test environments * local Debian 12 (bookworm) install, R 4.3.1 * Github actions @@ -23,12 +31,6 @@ Possibly misspelled words in DESCRIPTION: Rothe (17:47) covariates (18:42) -Found the following (possibly) invalid DOIs: - DOI: 10.1257/aer.20160945. - From: man/RDHonestBME.Rd - Status: 404 - Message: Not Found - The misspelled words are correct, "covariates" refers to independent variables in a regression. "Rothe" is a surname.