Closed nmarusan closed 2 years ago
According to rxode2
these two datasets are not equivalent
> library(rxode2)
one_add <- function(){
# initial estimates
ini({
# Fixed effects
tCl <- log(c(0, 3)) # log Cl (L/hr)
tV <- log(c(0, 10)) # log V (L)
# Random effects
eta.Cl ~ 0.1
eta.V ~ 0.1
# Residual error
add.err <- 12 # additive error
})
# Model
model({
# Model parameters
Cl <- exp(tCl + eta.Cl)
V <- exp(tV + eta.V)
# Elimination rate constant
Kel = Cl / V
# ODEs
d/dt(centr) = -Kel * centr;
# Concentration
C = centr / V;
# Additive error (estimated by the parameter add.err)
C ~ add(add.err)
})
}
f <- one_add()
d1 <- read.csv("c:/tmp/data1.csv")
d2 <- read.csv("c:/tmp/data2.csv")
rx <-f$simulationModel
d1 <- etTrans(d1, rx)
d2 <- etTrans(d2, rx)
library(waldo)
waldo::compare(d1, d2)
> > . + > > > > > > > > > > > > > > > > > `attr(class(old), '.rxode2.lst')$ndose`: 1200
`attr(class(new), '.rxode2.lst')$ndose`: 600
`attr(class(old), '.rxode2.lst')$nobs`: 104
`attr(class(new), '.rxode2.lst')$nobs`: 156
`attr(class(old), '.rxode2.lst')$allBolus`: FALSE
`attr(class(new), '.rxode2.lst')$allBolus`: TRUE
`attr(class(old), '.rxode2.lst')$mxCmt`: 1
`attr(class(new), '.rxode2.lst')$mxCmt`: 2
attr(attr(class(old), '.rxode2.lst')$keepL, 'row.names')[606:1008] vs attr(attr(class(new), '.rxode2.lst')$keepL, 'row.names')[606:608]
606
607
608
- 609
- 610
- 611
- 612
- 613
- 614
- 615
and 393 more ...
attr(old, 'row.names') | attr(new, 'row.names')
[606] 606 | 606 [606]
[607] 607 | 607 [607]
[608] 608 | 608 [608]
[609] 609 -
[610] 610 -
[611] 611 -
[612] 612 -
[613] 613 -
[614] 614 -
[615] 615 -
... ... ... and 393 more ...
old vs new
ID TIME EVID AMT II DV
- old[1, ] 1 0.0 10101 127.5 6 NA
+ new[1, ] 1 0.0 101 255.0 0 NA
- old[2, ] 1 2.0 10101 -127.5 0 NA
+ new[2, ] 1 0.0 0 NA 0 0.00
- old[3, ] 1 6.0 10101 127.5 0 NA
+ new[3, ] 1 6.0 101 255.0 0 NA
- old[4, ] 1 8.0 10101 -127.5 0 NA
+ new[4, ] 1 12.0 101 255.0 0 NA
- old[5, ] 1 12.0 10101 127.5 0 NA
+ new[5, ] 1 18.0 101 255.0 0 NA
- old[6, ] 1 14.0 10101 -127.5 0 NA
+ new[6, ] 1 24.0 101 255.0 0 NA
- old[7, ] 1 18.0 10101 127.5 0 NA
+ new[7, ] 1 30.0 101 255.0 0 NA
- old[8, ] 1 20.0 10101 -127.5 0 NA
+ new[8, ] 1 36.0 101 255.0 0 NA
- old[9, ] 1 24.0 10101 127.5 0 NA
+ new[9, ] 1 42.0 101 255.0 0 NA
- old[10, ] 1 26.0 10101 -127.5 0 NA
+ new[10, ] 1 48.0 101 255.0 0 NA
and 998 more ...
`old$ID[10:26]`: "1 " "1 " "1 " "1 " "1 " "1 " "1 " "1 " "1 " "1 " and 7 more...
`new$ID[10:15]`: "1 " "1 " "1 " ...
`old$ID[33:50]`: "2 " "2 " "2 " "2 " "2 " "2 " "2 " "2 " "4 " "4 " and 8 more...
`new$ID[22:27]`: "2 " "2 " "2 " ...
`old$ID[57:67]`: "4 " "4 " "4 " "4 " "6 " "6 " "6 " "6 " "6 " "6 " and 1 more...
`new$ID[34:39]`: "4 " "4 " "4 " "6 " "6 " ...
And 87 more differences ...
>
This is what is see:
`old$TIME`: 0 2 6 8 12 14 18 20 24 26 and 10 more...
`new$TIME`: 0 0 6 12 18 24 ...
old$EVID | new$EVID
[1] 10101 - 101 [1]
[2] 10101 - 0 [2]
[3] 10101 - 101 [3]
[4] 10101 - 101 [4]
[5] 10101 - 101 [5]
[6] 10101 - 101 [6]
[7] 10101 - 101 [7]
[8] 10101 - 101 [8]
[9] 10101 - 101 [9]
[10] 10101 - 101 [10]
... ... ... and 10 more ...
Which means d2
is assuming bolus dosing and d1
assumes infusions.
If you are using RxODE
or rxode2
with RATE
you cannot use the classic evid
information
Thank Dr. Fidler for responding to my personal question. I understand how the dataset is loaded through nlmixr.
Hi nlmixr team, I was trying to fit a 1-compartment model using the two datasets. I have tried:
The first dataset seems to work fine, but somehow, the second dataset cannot be estimated well. data2 is a conversion of data1. Why would the estimation results be different if I did not use ADDl and II, but only time?
I have struggled with this problem forever. Would be so appreciated if I could get some help, please. I have attached the dataset as well.
dataset.zip