11test_that(" plot censoring" , {
22 skip_on_cran()
33
4- dat <- xgxr :: case1_pkpd | >
4+ dat <-
5+ xgxr :: case1_pkpd | >
56 dplyr :: rename(DV = LIDV ) | >
67 dplyr :: filter(CMT %in% 1 : 2 ) | >
78 dplyr :: filter(TRTACT != " Placebo" )
89
910 doses <- unique(dat $ DOSE )
1011 nid <- 10 # 7 ids per dose group
11- dat2 <- do.call(" rbind" ,
12- lapply(doses , function (x ) {
13- ids <- dat | >
14- dplyr :: filter(DOSE == x ) | >
15- dplyr :: summarize(ids = unique(ID )) | >
16- dplyr :: pull()
17- ids <- ids [seq(1 , nid )]
18- dat | >
19- dplyr :: filter(ID %in% ids )
20- }))
12+ dat2 <-
13+ do.call(
14+ " rbind" ,
15+ lapply(doses , function (x ) {
16+ ids <- dat | >
17+ dplyr :: filter(DOSE == x ) | >
18+ dplyr :: summarize(ids = unique(ID )) | >
19+ dplyr :: pull()
20+ ids <- ids [seq(1 , nid )]
21+ dat | >
22+ dplyr :: filter(ID %in% ids )
23+ })
24+ )
2125
2226 # # Use 2 compartment model
2327 cmt2 <- function () {
@@ -44,19 +48,26 @@ test_that("plot censoring", {
4448 }
4549
4650 # # Check parsing
47- cmt2m <- nlmixr2est :: nlmixr(cmt2 )
51+ suppressMessages(
52+ cmt2m <- nlmixr2est :: nlmixr(cmt2 )
53+ )
4854
49- fit <-
50- nlmixr2est :: nlmixr(
51- cmt2m , dat2 , " saem" ,
52- control = list (print = 0 ),
53- table = nlmixr2est :: tableControl(cwres = TRUE , npde = TRUE )
54- )
55+ suppressMessages(
56+ fit <-
57+ nlmixr2est :: nlmixr(
58+ cmt2m , dat2 , " saem" ,
59+ control = nlmixr2est :: saemControl(print = 0 , nBurn = 10 , nEm = 20 ),
60+ table = nlmixr2est :: tableControl(cwres = TRUE , npde = TRUE )
61+ )
62+ )
5563
5664 apo <- nlmixr2est :: augPred(fit )
5765 expect_error(plot(apo ), NA )
58- expect_error(vpcPlot(fit , stratify = " DOSE" ), NA )
59- expect_error(vpcPlot(fit , pred_corr = TRUE , stratify = " DOSE" , log_y = TRUE ), NA )
66+ expect_error(vpcPlot(fit , stratify = " DOSE" , n = 10 ), NA )
67+ expect_message(
68+ vpcPlot(fit , pred_corr = TRUE , stratify = " DOSE" , log_y = TRUE , n = 10 ),
69+ regexp = " Prediction-correction cannot be used together with censored data"
70+ )
6071
6172 expect_error(plot(fit ), NA )
6273
0 commit comments