Closed namtien0312 closed 2 years ago
What is in the fit list. Sometimes you may have a nlmixr object in the fit.list[[i]]
Sorry Dr. Fidler for giving the incomplete code. The fit.list[[i]]
was created by:
model.list = c(Model1, Model2, Model3, Model4, Model5)
fit.list = list()
for (i in 1:length(model.list)) {
fit.list[[i]] = nlmixr(model.list[[i]], mydata, list(print=0), est="posthoc")
}
The "fit task" was successful for all 5 models.
Thank you for your help! Tien Nguyen.
Can you provide a reproducible example? Unfortunately, no matter how much I want to help, I cannot help unless It have a reproducible example.
In R this is often done by the helper package reprex:
Sorry Dr. Fidler for the late response due to the Time zone difference.
The error that I mentioned occurred with some data but didn't with another, so I think it may depend on the data which I had? So I need more time for giving you reproducible code with simulated data for which this error exists.
Thank you for your patience! Tien Nguyen.
Thank Dr. Fidler for kindly support, but I found a stupid mistake in that I missed EVID
variable in my dataset then the VPC task didn't work as I expected. But I wonder that why this error solely occurred for 2 models.
And by the way, Do the nlmixr
offer VPC with time after dose
instead of time
?
Tien Nguyen.
But I wonder that why this error solely occurred for 2 models.
It is unclear without the models. It is fishy though.
And by the way, Do the nlmixr offer VPC with time after dose instead of time?
I am guessing you could by using:
obs_cols = list(
dv = "dv",
idv = "tad")
This is taken from:
http://vpc.ronkeizer.com/continuous-data.html
I am unsure if the tad is retained, but if it isn't it could be at a later time.
Thank Dr. Fidler for your help!
Tien Nguyen.
Dear Dr. @mattfidler,
I don't know when I performed the tad
oftition with a real-world example that did not work.
Suppose I had a dataset like this.
df = tibble(
ID = c(rep(1, 6), rep(2, 6)),
TIME = c(0.00, 12.11, 18.41, 23.89, 36.00, 43.51, 0.00, 12.00, 20.00, 24.00, 36.80, 45.00),
AMT = c(1000, 1000, NA, 1000, 1000, NA, 1000, 2000, NA, 1000, 1000, NA),
DUR = c(2.5, 2.5, NA, 2.5, 2.5, NA, 2.5, 2.5, NA, 2.5, 2.5, NA),
DV = c(NA, NA, 3.0, NA, NA, 9.6, NA, NA, 7.0, NA, NA, 2.8),
WT = c(rep(55, 6), rep(48, 6))
) %>%
mutate(EVID = ifelse(is.na(DV), 1, 0))
model = function() {
ini({
tvCl <- c(0, 4, Inf)
tvVc <- c(0, 48, Inf)
eta.Vc ~ 0.62
prop.sd <- 0.051529
})
model({
Cl <- tvCl
Vc <- tvVc*(WT/70)*exp(eta.Vc)
# dynamical system
linCmt() ~ prop(prop.sd)
})
}
fit = nlmixr(model, df, list(print=0), est="posthoc")
vpc(fit, pred_corr = TRUE, show = list(obs_dv = T),
obs_cols = list(
dv = "dv",
idv = "tad"))
Sure that the fit object
has tad
. The x-axis also was time
rather than tad
fit$tad
[1] 3.80 5.01 5.50 5.70
Thank you for your help! Tien.
@namtien0312 did you find a solution to this? I think possibly same issue as feature request here https://github.com/nlmixrdevelopment/nlmixr/issues/483
Thank @dlonsdal for your information!
Dear nlmixr team,
I had an error when performing VPC like this:
Code is simply that (the error solely existed for
fit.model
2 and 4 in the iteration? - The "fit task" was successful for all 5 models).Thank you for your help! Tien Nguyen.