aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test-dmta.R
blob: 12bbcb8ea63b14ded00b804e0e3dbdddd1594bfa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
local_edition(3)

# Data
dmta_ds <- lapply(1:7, function(i) {
  ds_i <- dimethenamid_2018$ds[[i]]$data
  ds_i[ds_i$name == "DMTAP", "name"] <-  "DMTA"
  ds_i$time <- ds_i$time * dimethenamid_2018$f_time_norm[i]
  ds_i
})
names(dmta_ds) <- sapply(dimethenamid_2018$ds, function(ds) ds$title)
dmta_ds[["Elliot"]] <- rbind(dmta_ds[["Elliot 1"]], dmta_ds[["Elliot 2"]])
dmta_ds[["Elliot 1"]] <- dmta_ds[["Elliot 2"]] <- NULL

# mkin
nlm_dfop <- mmkin("DFOP", dmta_ds)
nlm_dfop_tc <- mmkin("DFOP", dmta_ds, error_model = "tc")
parms(nlm_dfop_tc)

# nlme
nlme_dfop_tc <- nlme(nlm_dfop_tc)
summary(nlme_dfop_tc)
intervals(nlme_dfop_tc)

# saemix
saem_saemix_dfop_tc <- saem(nlm_dfop_tc)
saem_saemix_dfop_tc$so <- saemix::llgq.saemix(saem_saemix_dfop_tc$so)
summary(saem_saemix_dfop_tc)
intervals(saem_saemix_dfop_tc)
AIC(saem_saemix_dfop_tc$so)
AIC(saem_saemix_dfop_tc$so, "gq")
AIC(saem_saemix_dfop_tc$so, "lin")
saemix::plot(saem_saemix_dfop_tc$so, plot.type = "likelihood")
saemix::plot(saem_saemix_dfop_tc$so, plot.type = "convergence")

saem_saemix_dfop_tc_1k <- saem(nlm_dfop_tc, nbiter.saemix = c(1000, 100))
AIC(saem_saemix_dfop_tc_1k$so)
saemix::plot(saem_saemix_dfop_tc_1k$so, plot.type = "convergence")
saemix::plot(saem_saemix_dfop_tc_1k$so, plot.type = "likelihood")
intervals(saem_saemix_dfop_tc_1k)

saem_saemix_dfop_tc_1.5k <- saem(nlm_dfop_tc, nbiter.saemix = c(1500, 100))
saem_saemix_dfop_tc_1.5k$so <- saemix::llgq.saemix(saem_saemix_dfop_tc_1.5k$so)
saemix::plot(saem_saemix_dfop_tc_1.5k$so, plot.type = "convergence")
AIC(saem_saemix_dfop_tc_1.5k$so)
AIC(saem_saemix_dfop_tc_1.5k$so, "gq")
intervals(saem_saemix_dfop_tc_1.5k)

# nlmixr saem
saem_nlmixr_dfop_tc <- nlmixr(nlm_dfop_tc, est = "saem",
  control = nlmixr::saemControl(nBurn = 300, nEm = 100, nmc = 9, print = 0))
intervals(saem_nlmixr_dfop_tc)
summary(saem_nlmixr_dfop_tc)
AIC(saem_nlmixr_dfop_tc$nm)

saem_nlmixr_dfop_tc_1k <- nlmixr(nlm_dfop_tc, est = "saem",
  control = nlmixr::saemControl(nBurn = 1000, nEm = 300, nmc = 9, print = 0))
intervals(saem_nlmixr_dfop_tc_1k)
summary(saem_nlmixr_dfop_tc_1k)
AIC(saem_nlmixr_dfop_tc_1k$nm)

focei_nlmixr_dfop_tc <- nlmixr(nlm_dfop_tc, est = "focei")
intervals(focei_nlmixr_dfop_tc)

AIC(saem_nlmixr_dfop_tc$nm)

Contact - Imprint