Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use weight-based dosing for a population within add.dosing() #475

Open
SGastine opened this issue May 30, 2022 · 2 comments
Open

Use weight-based dosing for a population within add.dosing() #475

SGastine opened this issue May 30, 2022 · 2 comments

Comments

@SGastine
Copy link

SGastine commented May 30, 2022

Hi,
I have a new issue when using RxODE 1.1.5.
With the previous version I was able to pull in covariates from pre-defined populations into my event tables. Now I get an error message that dose within add.dosing can only have length 1.
It was quite a neat feature to simulated complex weight and bsa-based regimen. Is there a way to get this working again?

Thanks!
Silke

Here is my example code:

e_1 <-   et(id=sim.cov$id) %>%
  add.dosing(start.time = 0,dose = 600000*sim.cov$wt, nbr.doses = 14, dosing.interval = 8, dur=15/60) %>% 
  add.dosing(start.time = (5+9)*24,dose = 600000*sim.cov$wt, nbr.doses = 14, dosing.interval = 8, dur=15/60) %>%
  add.sampling(seq(from = 0, to = 24*21, by = 0.25)) %>%
  as.data.frame %>%
  merge(sim.cov, by="id") 
@mattfidler
Copy link
Collaborator

#475

@mattfidler
Copy link
Collaborator

Hi, @SGastine

Indeed this can be useful. I have opened a feature request in rxode2, as I no longer develop this package.

In the mean-time you can still do weight based dosing as follows:

library(RxODE)
#> RxODE 1.1.5 using 4 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`

sim.cov <- data.frame(id=1:10,
                      wt=rnorm(10, 70, 10),
                      sexf=round(runif(10)))

e_1 <-   et(id=sim.cov$id) %>%
  add.dosing(start.time = 0,dose = 600000, nbr.doses = 14, dosing.interval = 8, dur=15/60) %>%
  add.dosing(start.time = (5+9)*24,dose = 600000, nbr.doses = 14, dosing.interval = 8, dur=15/60) %>%
  add.sampling(seq(from = 0, to = 24*21, by = 0.25)) %>%
  as.data.frame %>%
  merge(sim.cov, by="id")

e_1$amt <- ifelse(is.na(e_1$amt), NA_real_, e_1$amt / e_1$wt)

print(head(e_1))
#>   id time      amt ii addl evid  dur      wt sexf
#> 1  1 0.00       NA NA   NA    0   NA 90.4123    0
#> 2  1 0.00 6636.265  8   13    1 0.25 90.4123    0
#> 3  1 0.25       NA NA   NA    0   NA 90.4123    0
#> 4  1 0.50       NA NA   NA    0   NA 90.4123    0
#> 5  1 0.75       NA NA   NA    0   NA 90.4123    0
#> 6  1 1.00       NA NA   NA    0   NA 90.4123    0

Created on 2022-05-30 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants