Define a cohort to include in a parameter estimation
system_define_cohort(cfg, cohort)ubiquity system object
list with cohort information
ubiquity system object with cohort defined
Each cohort has a name (eg d5mpk), and the dataset containing the
information for this cohort is identified (the name defined in system_load_data)
cohort = c() cohort$name = <U+2019>d5mpk<U+2019> cohort$dataset = <U+2019>pmdata<U+2019>
Next it is necessary to define a filter (cf field) that can be
applied to the dataset to only return values relevant to this cohort. For
example, if we only want records where the column DOSE is 5 (for the 5
mpk cohort). We can
cohort$cf$DOSE = c(5)
If the dataset has the headings ID, DOSE and SEX and
cohort filter had the following format:
cohort$cf$ID = c(1:4) cohort$cf$DOSE = c(5,10) cohort$cf$SEX = c(1)
It would be translated into the boolean filter:
((ID==1) | (ID==2) | (ID==3) | (ID==4)) & ((DOSE == 5) | (DOSE==10)) & (SEX == 1)
Next we define the dosing for this cohort. It is only necessary to define
those inputs that are non-zero. So if the data here were generated from
animals given a single 5 mpk IV at time 0. If in the model this was defined
using <B:times> and <B:events> dosing into the central
compartment Cp, you would pass this information to the cohort in the
following manner:
cohort$inputs$bolus$Cp$AMT = c(5) cohort$inputs$bolus$Cp$TIME = c(0)
Inputs can also include any infusion rates (infusion_rates) or
covariates (covariates). Covariates will have the default value
specified in the system file unless overwritten here. The units here are
the same as those in the system file
Next we need to map the outputs in the model to the observation data in the
dataset. Under cohort.outputs there is a field for each output. Here the field ONAME
can be replaced with something more useful (like PK). The times and
observations in the dataset are found in the <U+2019>TIMECOL<U+2019> column and the <U+2019>OBSCOL<U+2019> column
(optional missing data option specified by -1). These are mapped to the model outputs (which
MUST have the same units) <U+2019>TS<U+2019> and <U+2019>MODOUTPUT'. The variance model
'VARMOD' is a string containing the variance model written in terms
of the model prediction (PRED), variance parameters (defined with
<VP> in the system file), and numbers. To do a least squares
cohort$outputs$ONAME$obs$time = <U+2019>TIMECOL<U+2019> cohort$outputs$ONAME$obs$value = <U+2019>OBSCOL<U+2019> cohort$outputs$ONAME$obs$missing = -1 cohort$outputs$ONAME$model$time = <U+2019>TS' cohort$outputs$ONAME$model$value = <U+2019>MODOUTPUT<U+2019> cohort$outputs$ONAME$model$variance = <U+2019>VARMOD'
Note: Output names should be consistent between cohorts so they will be grouped together when plotting results.
Optionally we can add information about the markers to use when plotting the output for this cohort:
cohort$outputs$ONAME$options$marker_color = 'black' cohort$outputs$ONAME$options$marker_shape = 16 cohort$outputs$ONAME$options$marker_line = 1
Lastly we define the cohort:
Estimation vignette (vignette("Estimation", package = "ubiquity"))