Skip to content

Commit

Permalink
No script for now. Add more commentary
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Sep 23, 2024
1 parent bebad0e commit f837715
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
2 changes: 2 additions & 0 deletions R/poped.R
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,7 @@ rxUiGet.popedSettings <- function(x, ...) {
if (is.null(rxode2::rxGetControl(ui, "script", NULL))) {
.ret
} else {
stop("script is not supported yet", call.=FALSE)
.parallel <- .ret$settings$parallel
.settings <- .ret$settings
.settings$parallel <- NULL
Expand Down Expand Up @@ -1796,6 +1797,7 @@ rxUiGet.popedOptsw <- function(x, ...) {
)
return(.appendPopedProps(.ret, .ctl))
} else {
stop("script is not supported yet", call.=FALSE)
.w <- which(.nd == "evid")
if (length(.w) == 1L) {
popedDosing <- lapply(seq_along(.ids),
Expand Down
49 changes: 31 additions & 18 deletions inst/poped/ex.8.tmdd_qss_one_target_compiled.babelmixr2.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

library(babelmixr2)

library(PopED)
Expand Down Expand Up @@ -99,19 +100,42 @@ db <- nlmixr2(f, e, "poped",
SC_FLAG=c(0,1)),
))

m1 <- microbenchmark::microbenchmark(compareTime=evaluate_design(db), times=25)
# This is a longer running example, so the choice to check times for
# changes each time may not be ideal.

# For this first example, we will not check time differences, which
# speeds up solving a bit

db <- babel.poped.database(db, optTime=FALSE)

tic();e1 <- evaluate_design(db);toc()

# You can see that without allowing times to be changed, you close the
# same value as the original ex.8.tmdd from PopED (with a little rounding error)

# Original example:
## $rse
## CL V1 Q V2 FAVAIL KA R0 KSSS
## 2.418464 2.493863 2.390597 2.757785 3.023260 4.838732 2.800056 3.122798
## KDEG KINT d_CL d_V1 d_Q d_V2 d_FAVAIL d_KA
## 2.711192 2.431927 10.830828 12.269644 22.271256 20.032780 24.240763 19.409710
## d_R0 d_KSSS d_KDEG d_KINT SIGMA[1,1] SIGMA[2,2]
## 11.890735 13.446074 20.396815 18.125143 2.731176 2.906398

# If you check for time changes, this is slower and gives a slightly
# different answer
db <- babel.poped.database(db, optTime=TRUE)

tic();e2 <- evaluate_design(db);toc()


# You can see the differences between the two with microbenchmark.
m1 <- microbenchmark::microbenchmark(compareTime=evaluate_design(db), times=25)

# Models created by babelmixr2 check for time and model_switch
# changes. If you are not optimizing over times, some can be lost

db <- babel.poped.database(db, optTime=FALSE)

# This takes a little less time to run the times are only setup once
tic();e2 <- evaluate_design(db);toc()

m2 <- microbenchmark::microbenchmark(assumeTimesDontChange=evaluate_design(db), times=25)

# But this may not matter in the problem (like this one). In most
Expand All @@ -126,18 +150,7 @@ m3 <- rbind(m1, m2)

autoplot(m3)

# Going back to the model where time differences are not checked:
db <- babel.poped.database(db, optTime=FALSE)

plot_model_prediction(db, model_num_points=300, PI=TRUE, facet_scales="free")

#plot_model_prediction(db,facet_scales="free")

# Original example:
## $rse
## CL V1 Q V2 FAVAIL KA R0 KSSS
## 2.418464 2.493863 2.390597 2.757785 3.023260 4.838732 2.800056 3.122798
## KDEG KINT d_CL d_V1 d_Q d_V2 d_FAVAIL d_KA
## 2.711192 2.431927 10.830828 12.269644 22.271256 20.032780 24.240763 19.409710
## d_R0 d_KSSS d_KDEG d_KINT SIGMA[1,1] SIGMA[2,2]
## 11.890735 13.446074 20.396815 18.125143 2.731176 2.906398

tic();e2 <- evaluate_design(db);toc()

0 comments on commit f837715

Please sign in to comment.