Closed AlexandreLeM closed 1 year ago
Hi Alexandre, thanks for posting here, Glad to here that it works on palbo data vs monolix
To answer your first question, there are no option to remove the population confidence interval. And it should be possible ideally. I'll patch this later. In the meantime, you can just set the value_up and value_low of "PRED" to NA in the aug_tab.
My_simu$aug_tab$value_low[My_simu$aug_tab$type=="PRED"] <- NA
My_simu$aug_tab$value_up[My_simu$aug_tab$type=="PRED"] <- NA
plot(My_simu)
Or just filter the data with IPRED to drop all the "PRED" related data
My_simu$aug_tab <- filter(My_simu$aug_tab, type == "IPRED")
plot(My_simu)
Note that the reported confidence interval is an approximation to several respects:
stats::optimHess
but one could try nlmixr::nlmixrHess
(see https://github.com/FelicienLL/mapbayr/issues/43#issuecomment-1028151709). Both return results somewhat different from NONMEM: sometimes it is rather close (for simple problems), sometimes it is rather far-off (mainly for complex problems).ci_method = "simulations"
). Since it can be rather long, one can use the "delta method" (see Kümmel et al, CPT PSP, 2018), which is an approximation but faster. This is why I set it to default when the user want to plot the results.For your second question, the best solution is use_posterior()
. It turns your estimation object into a mrgsolve model with updated eta and covariates of your patient. Then feel free to simulate any dose regimen within the mrgsolve framework. You can also update_omega = TRUE
to replace the OMEGA (prior) matrix into the posterior matrix, thus simulating with uncertainty.
I set a little example below from your code. It shows how to plot and report probability of success of several dosing regimens. Again: it assumes that parameter uncertainty is well described by the covariance matrix computed within the package, which, as you understand, is maybe (maybe not?) doubtful: I would recommend a comprehensive validation before implementing anything. Feel free to come back to me if you need anything else.
Hope it helps
Félicien
scenarios <- expand.ev(
ID = 1:1000,
amt = c(75000, 100000, 125000, 150000),
addl = 15, ii = 24) %>%
mutate(DOSE = amt/1000)
sims <- my_est %>%
use_posterior(update_omega = TRUE) %>%
ev(scenarios) %>%
mrgsim(start = 336, end = 360, obsonly = TRUE, carry_out = "DOSE")
tab <- sims %>%
group_by(DOSE, time) %>%
summarise(Q05 = quantile(DV, 0.05),
Q50 = quantile(DV, 0.50),
Q95 = quantile(DV, 0.95)) %>%
mutate(DOSE = as.factor(DOSE))
#> `summarise()` has grouped output by 'DOSE'. You can override using the
#> `.groups` argument.
tab %>%
ggplot(aes(time)) +
geom_ribbon(aes(ymin = Q05, ymax = Q95, fill = DOSE), alpha = .5) +
geom_line(aes(y = Q50)) +
facet_grid(.~DOSE) +
theme_bw()
sims %>%
filter(time == 360) %>%
group_by(DOSE) %>%
summarise(
MEDIAN_CONC = median(DV),
OK = sum(DV > 97),
PERC_OK = scales::percent(OK/1000))
#> # A tibble: 4 x 4
#> DOSE MEDIAN_CONC OK PERC_OK
#> <dbl> <dbl> <int> <chr>
#> 1 75 46.1 0 0%
#> 2 100 61.4 33 3%
#> 3 125 75.5 167 17%
#> 4 150 90.0 385 38%
Created on 2022-03-30 by the reprex package (v2.0.1)
N.B.: note that I am currently optimizing the computational performance of the package: it is mainly in order to implement SIR. SIR will be more accurate than this Gaussian approximation when we want to derive a conf interval.
Hello,
First of all, congratulations for your work.
I have started to use your package and for the moment I have coded the palbociclib model which gives similar residual concentration estimates to those estimated by monolix.
I would like to be able to make graphs with just the patient kinetics, observation and a confidence interval. The problem is that I can't remove the population kinetics from the plot(my_est).
I have created a code for a graph but perhaps there is an easier option.
I would also like to simulate scenarios with a new dosage and to make a graph with this new kinetic and its confidence interval. But I have not been able to find a way to do this. Could you tell me if this is possible and if so, show me?
Thanks!
Alexandre
Here is the code that allows me to obtain this type of graph