From 5960f11b310595f4b7ba425ec70d89350ea91e4b Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Sun, 26 May 2024 06:57:08 -0500 Subject: [PATCH 1/4] Remove qstrict --- src/checkmate_stub.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/checkmate_stub.c b/src/checkmate_stub.c index ab9b1aa..9b73b9a 100644 --- a/src/checkmate_stub.c +++ b/src/checkmate_stub.c @@ -66,10 +66,3 @@ void qstrict0(SEXP nn, const char *what){ } UNPROTECT(1); } - -// By Matt -void qstrict(SEXP x, const char *what) { - SEXP nn = PROTECT(getAttrib(x, R_NamesSymbol)); - qstrict0(nn, what); - UNPROTECT(1); -} From cffe2bcc84561c222e73f6bf23b883e79a06a5da Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Thu, 6 Jun 2024 21:42:23 -0500 Subject: [PATCH 2/4] Fix for cvPost --- CRAN-SUBMISSION | 6 +++--- src/cvPost.cpp | 36 ++++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index cddd719..795e00a 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 2.1.0 -Date: 2024-05-25 23:39:06 UTC -SHA: 2d3961f6300b8e585c8d859e3cfba49dcbe12d96 +Version: 2.1.1 +Date: 2024-05-25 23:54:54 UTC +SHA: 4119733f949e30b97c6a83fe737cdcc45235e9b9 diff --git a/src/cvPost.cpp b/src/cvPost.cpp index b169378..e0532af 100644 --- a/src/cvPost.cpp +++ b/src/cvPost.cpp @@ -873,7 +873,7 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) { ni = nestingInfo_(omegaLotri, eventsL); IntegerVector idIV = as(ni["id"]);//length(levels(.ni$id)) nid = Rf_length(Rf_getAttrib(idIV, R_LevelsSymbol)); - if (nid <= 1){ + if (nid <= 1) { } else if (nSub <= 1) { // control[Rxc_nSub] = nid; nSub = nid; @@ -934,11 +934,20 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) { methodStr = as(control[Rxc_omegaSeparation]); methodInt = getMethodInt(methodStr, allNames, et); + if (Rf_isNull(lotriAbove)) { + aboveSEXP = R_NilValue; + rxModelsAssign(".nestEvents", events); + rxModelsAssign(".nestEta", R_NilValue); + rxModelsAssign(".nestTheta", R_NilValue); + } + if (!Rf_isNull(aboveSEXP)) { // Create an extra theta matrix list // // Note this is for between study variability and the - // method/specification comes from omega, so methodInt comes from omegaSeparation + // method/specification comes from omega, so methodInt comes from + // omegaSeparation + SEXP thetaList = PROTECT(cvPost_(et, lotriAbove, nStudS, LogicalVector::create(false), @@ -955,16 +964,16 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) { NumericVector upper = bounds[0]; NumericVector lower = bounds[1]; // With - NumericMatrix aboveMat = rxRmvnSEXP(IntegerVector::create(1), - R_NilValue, thetaList, - upper, lower, // lower upper - control[Rxc_nCoresRV], - LogicalVector::create(false), // isChol - LogicalVector::create(true), // keepNames - NumericVector::create(0.4), // a - NumericVector::create(2.05), // tol - NumericVector::create(1e-10), // nlTol - IntegerVector::create(100)); // nlMaxiter + NumericMatrix aboveMat = rxRmvnSEXP(IntegerVector::create(1), + R_NilValue, thetaList, + upper, lower, // lower upper + control[Rxc_nCoresRV], + LogicalVector::create(false), // isChol + LogicalVector::create(true), // keepNames + NumericVector::create(0.4), // a + NumericVector::create(2.05), // tol + NumericVector::create(1e-10), // nlTol + IntegerVector::create(100)); // nlMaxiter DataFrame newLst = as(aboveMat); if (!Rf_isNull(et) && Rf_length(et) != 0){ CharacterVector etListNames = asCv(Rf_getAttrib(et, R_NamesSymbol), "names(et)"); @@ -990,6 +999,9 @@ SEXP expandPars_(SEXP objectS, SEXP paramsS, SEXP eventsS, SEXP controlS) { } else { rxModelsAssign(".thetaL", R_NilValue); } + if (Rf_isNull(lotriBelow)) { + belowSEXP = R_NilValue; + } if (!Rf_isNull(belowSEXP)) { // below to sample matrix SEXP omegaList = PROTECT(cvPost_(et, // In case needed From c685c5b428f83ff34b452ce960a0a49b05edb7df Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Thu, 6 Jun 2024 21:43:08 -0500 Subject: [PATCH 3/4] Increment version number to 2.1.1.9000 --- DESCRIPTION | 2 +- NEWS.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index eed1cfb..297a63e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rxode2random Title: Random Number Generation Functions for 'rxode2' -Version: 2.1.1 +Version: 2.1.1.9000 Authors@R: c( person("Matthew L.", "Fidler", , "matthew.fidler@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-8538-6691")), diff --git a/NEWS.md b/NEWS.md index a429f11..50e0124 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,5 @@ +# rxode2random (development version) + # rxode2random 2.1.0 - **Breaking Change** changed distributions from the standard C++ From d48d510d98eb010d88c4f17f3b02039976323cd0 Mon Sep 17 00:00:00 2001 From: "Matthew L. Fidler" Date: Thu, 6 Jun 2024 21:43:41 -0500 Subject: [PATCH 4/4] Add to news --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 50e0124..05b5d9d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # rxode2random (development version) +- Fix a bug when simulating nested variables (#25) + # rxode2random 2.1.0 - **Breaking Change** changed distributions from the standard C++