Calvagone / campsis

A generic PK/PD simulation platform based on rxode2 and mrgsolve engines.
https://calvagone.github.io/
GNU General Public License v3.0
8 stars 3 forks source link

More than two observations times? #158

Closed jsmccune14 closed 1 week ago

jsmccune14 commented 1 week ago

I am trying to simulate datasets with three to five pharmacokinetic sampling times. They're not at routine intervals, so I need to type them manually.
This will create ds2 ds2 <-Dataset()%>% setSubjects(nsubjects)%>%add(Covariate("BW", UniformDistribution(min=35, max=49)))%>%add(Observations(times=(7, 83.9965, 168)))) This will NOT create ds2 ds2 <-Dataset()%>% setSubjects(nsubjects)%>%add(Covariate("BW", UniformDistribution(min=35, max=49)))%>%add(Observations(times=(7, 84, 168)))) Error: unexpected ',' in "ds2 <-Dataset()%>% setSubjects(nsubjects)%>%add(Covariate("BW", UniformDistribution(min=35, max=49)))%>%add(Observations(times=(7,84,168))))

I didn't see any insight from the August 2024 R documentation for campsis and I didn't see any similar issues. Can you please advise if this functionality is available? I'd also like to simulate a dataset with four observation times). Thank you!

luyckxn commented 1 week ago

Hi jsmccune14,

Our documentation can be found here: https://calvagone.github.io/campsis.doc/ (check out also www.campsis.org) The first vignette shows how to build your dataset: https://calvagone.github.io/campsis.doc/articles/v01_dataset.html

Argument 'times' accepts a numeric vector with all the observation times to simulate. You need to use the R syntax, i.e. c(0,1,2,4,6,8,12).

Example:

library(campsis)

dataset <- Dataset(10) %>%
  add(Covariate("BW", UniformDistribution(min=35, max=49))) %>%
  add(Observations(times=c(7, 84, 168)))

print(dataset)
jsmccune14 commented 3 days ago

Thank you for your help!