Skip to content

Problematic time interpolation for user defined PK parameters #2546

@Yuri05

Description

@Yuri05

For the user defined PK parameters with a given time range, the indices of the start/end value points are estimated using the ArrayHelper.ClosestIndexOf() function :

var startIndex = ArrayHelper.ClosestIndexOf(time, startTime);
var endIndex = ArrayHelper.ClosestIndexOf(time, endTime);

(also used for the estimation of time indices for the dosing intervals)

var dosingStartIndex = ArrayHelper.ClosestIndexOf(time, dosingInterval.StartValue);
var dosingEndIndex = ArrayHelper.ClosestIndexOf(time, dosingInterval.EndValue);

The function ArrayHelper.ClosestIndexOf()is defined as following:

private static int closestIndexOf(List<float> list, float value)
{
int index = list.BinarySearch(value);
//already exist return
if (index >= 0)
return index;
//does not exist in the list. We find the index of the point immediately after this value
var closestIndex = ~index;
return closestIndex < list.Count ? closestIndex : -1;
}
}

The problem is: if the time point is not on the simulation output raster, the function returns not the closest time index but the next time index after the time of interest.

This might result in significant deviations compared to the expected result.

E.g. in the attached simulation, the output schema results in the time vector (in days):

...
12,99848
13,00889
...

46_Ctrough.zip

The applications are given once daily (particularly at t=13 days).

Simulated values for Peripheral Venous Blood look like this:

Time [day(s)] PeripheralVenousBlood-C1-Plasma (Peripheral Venous Blood) [µmol/l]
12,99848 1,624205
13,00889 3,23945

Now when defining a user defined PK parameter for CTrough between 12 and 13 days, I would expect to get the value 1,62. But I get 3,24 instead.

library(ospsuite)

sim <- loadSimulation("S1.pkml")
simRes <- runSimulation(sim)

ctrough_md <- addUserDefinedPKParameter(name = "ctrough_md", standardPKParameter = StandardPKParameter$C_trough)
ctrough_md$startTime <- 12*24*60 #17280 min
ctrough_md$endTime <- 13*24*60   #18720 min

pkAnalysis <- calculatePKAnalyses(results = simRes)
outputPath <- simRes$allQuantityPaths[[1]]
print(outputPath)
allPkParams <- pkAnalysis$allPKParametersFor(outputPath)

trough <- pkAnalysis$pKParameterFor(quantityPath = outputPath, pkParameter = "ctrough_md")
trough$values

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions