Skip to content

Commit a0e5d77

Browse files
authored
Merge pull request #506 from nlmixr2/505-cwres
CWRES bug introduced in nlmixr2est 3.0.3
2 parents f474cd8 + c8bcd6a commit a0e5d77

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
_R_CHECK_FORCE_SUGGESTS_: false
1919

2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222

2323
- uses: r-lib/actions/setup-r@v2
2424
with:

R/focei.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,9 @@ rxUiGet.foceiSkipCov <- function(x, ...) {
13001300
assign("nEstOmega", length(which(!is.na(ui$iniDf$neta1) & !ui$iniDf$fix)),
13011301
env)
13021302
if (length(env$skipCov) != .maxTheta) {
1303-
stop("'skipCov' improperly specified", call.=FALSE)
1303+
.iniTheta <- ui$iniDf[!is.na(ui$iniDf$ntheta), ]
1304+
env$skipCov <- is.na(.iniTheta$err)
1305+
warning("'skipCov' improperly specified, reset", call.=FALSE)
13041306
}
13051307
}
13061308

tests/testthat/test-addCwres.R

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,40 @@ nmTest({
2929
regexp = "cannot add CWRES to a model without etas"
3030
)
3131
})
32+
33+
test_that("cwres issue in 3.0.3", {
34+
35+
skip_if_not(file.exists(test_path("test-cwres-3.0.3.qs")))
36+
37+
data <- qs::qread(test_path("test-cwres-3.0.3.qs"))
38+
39+
test_model <- function() {
40+
ini({
41+
lcl <- log(3)
42+
lvc <- log(40)
43+
prop.err <- 0.1
44+
eta.cl ~ 0.1
45+
eta.vc ~ 0.1
46+
WT_Cl <- fix(0.75)
47+
ClCrEff <- 1
48+
})
49+
model({
50+
cl<- exp(lcl + eta.cl + WT_Cl * log(Weight/81.60) + ClCrEff * log(ClCr/77.73))
51+
vc <- exp(lvc + eta.vc)
52+
d/dt(A_cen) = - cl/vc * A_cen
53+
cp = A_cen/vc
54+
cp ~ prop(prop.err)
55+
})
56+
}
57+
58+
test_run001 <-
59+
nlmixr2(
60+
test_model(),
61+
data,
62+
"saem",
63+
control=list(print=0, nBurn=1, nEm=1))
64+
65+
expect_error(addCwres(test_run001), NA)
66+
67+
})
3268
})

tests/testthat/test-cwres-3.0.3.qs

4.88 KB
Binary file not shown.

0 commit comments

Comments
 (0)