Replies: 1 comment
-
Hi @mahmed452 - There isn't a specific function for doing this sort of calculation. You can use mrgsolve to simulate out the profiles and then analyze them using code that is already available in R. I'm including an example below. Depending on the problem, you can make life simpler by only sampling at the relevant times. So, in the example I coded BID dosing and I sampled every 12 hours. That way I only have troughs and it is easy to look trough to trough to assess steady state. Obviously you'll have to tailor this for your problem, but hope this helps to get going. Please let me know if I can help with anything else. Kyle library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(ggplot2)
library(mrgsolve)
#>
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#>
#> filter
mod <- modlib("popex", end = 28*24, delta = 1)
#> Building popex ...
#> done.
mod <- update(mod, outvars = "ECL,CP = IPRED")
dose <- expand.ev(amt = 100, ii = 12, total = 28*2, ID = 1:9)
set.seed(12345)
out <- mrgsim(mod, dose)
plot(out) out2 <- mrgsim(mod, dose, delta = 12)
plot(out2) Time to steady state sims <-
out2 %>%
mutate(dosen = floor(time/12)) %>%
group_by(ID) %>%
mutate(percent = 100 * CP / last(CP))
ggplot(sims, aes(time, percent, col = factor(ID))) +
geom_line() ggplot(sims, aes(dosen, percent, col = factor(ID))) +
geom_line() + geom_point() +
scale_x_continuous(limits = c(0,20), breaks = seq(0,20,2)) +
geom_hline(yintercept = 90, lty = 2)
#> Warning: Removed 324 row(s) containing missing values (geom_path).
#> Warning: Removed 324 rows containing missing values (geom_point). Time to greater than 90% of steady statesims %>%
group_by(ID) %>%
filter(percent > 90) %>%
slice(1)
#> # A tibble: 9 x 6
#> # Groups: ID [9]
#> ID time ECL CP dosen percent
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 60 -0.228 8.43 5 93.5
#> 2 2 24 0.814 1.84 2 92.9
#> 3 3 36 0.0706 5.38 3 95.6
#> 4 4 60 -0.274 8.29 5 92.0
#> 5 5 72 -0.419 10.6 6 92.3
#> 6 6 48 0.460 3.88 4 91.8
#> 7 7 48 -0.160 7.87 4 91.7
#> 8 8 264 -1.34 27.7 22 90.5
#> 9 9 48 -0.0295 5.98 4 90.4 Created on 2021-06-21 by the reprex package (v2.0.0) |
Beta Was this translation helpful? Give feedback.
-
Hi,
I would like to simulate both first common dosing interval (for different dosing regimens) and steady state for a population with different covariates effect as well as with random effect. My main interest is to understand for the different regimens, the percentage of individual who reached specific percentage of steady sate (say 90% of steady state) at specified time points (say after 1 dose, 2 doses, 3 doses, etc). Is there specific function in mrgsolve that can handle that? I know that you can indicate simulation at SS in the mrgsolve. However, i am not sure if there is a way to understand what is the number of doses needed to reach specific percentage of steady state.
thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions