Closed billdenney closed 1 year ago
Actually, it is not specific to linCmt()
. I don't know why EVID 1 is becoming EVID 2.
The underlying issue was that there was no AMT
column.
So, that changes the issue request to please give a warning when there are dosing EVIDs but no AMT. Is there a scenario where that combination could be desired?
library(nlmixr2)
#> Loading required package: nlmixr2data
library(nlmixr2lib)
library(babelmixr2)
d_simple <-
data.frame(ID = 1, EVID = c(1, 0), cmt = c("depot", "central"), DV = c(NA, 1), TIME = 0:1, AMT = c(1, 0))
model <- readModelDb("PK_1cmt")
babelmixr2:::.bblDatToNonmem(model = model, data = d_simple, table = nlmixr2est::tableControl(),
fun="bblDatToPknca", replaceEvid=5L,
replaceOK=TRUE, software="pknca", env=NULL)
#> ID TIME EVID AMT II DV CMT DVID SS nlmixrRowNums
#> 1 1 0 1 1 0 NA 1 0 0 1
#> 2 1 1 0 NA 0 1 2 0 0 2
Created on 2023-05-31 with reprex v2.0.2
AMT could be missing with a $PRED
model. EVID really should be missing there too....
@mattfidler, Yes, I can see scenarios where AMT is missing (like a $PRED
-only model), and I can even imagine that EVID could be present in those cases (e.g. you want to use EVID = 2 to get a prediction without an observation or to modify some time-dependent phenomenon). But, I can't see a scenario where EVID indicates a dose and AMT is missing (or NA
).
That's making me think that EVID indicating a dose and no AMT column should be an error.
Probably. This is now in the wrong repository. Transferring.
FYI, amt=na
were already handled.
Created on 2023-05-30 with reprex v2.0.2