View source: R/utilities-data-combined.R
calculateResiduals | R Documentation |
DataCombined
Calculate residuals for datasets in DataCombined
calculateResiduals(dataCombined, scaling, xUnit = NULL, yUnit = NULL)
dataCombined |
A single instance of |
scaling |
A character specifying scale: either |
xUnit , yUnit |
Target units for |
To compute residuals, for every simulated dataset in a given group, there should also be a corresponding observed dataset. If this is not the case, the corresponding observed or simulated datasets will be removed.
When multiple (observed and/or simulated) datasets are present in
DataCombined
, they are likely to have different units. The xUnit
and
yUnit
arguments help you specify a common unit to convert them to.
In the returned tibble data frame, the following columns will always be present:
xValues - xUnit - xDimension - yValuesObserved - yUnit - yDimension - yErrorValues - yErrorType - yErrorUnit - yValuesSimulated - residualValues
Other data-combined:
DataCombined
,
convertUnits()
# simulated data
simFilePath <- system.file("extdata", "Aciclovir.pkml", package = "ospsuite")
sim <- loadSimulation(simFilePath)
simResults <- runSimulations(sim)[[1]]
outputPath <- "Organism|PeripheralVenousBlood|Aciclovir|Plasma (Peripheral Venous Blood)"
# observed data
obsData <- lapply(
c("ObsDataAciclovir_1.pkml", "ObsDataAciclovir_2.pkml", "ObsDataAciclovir_3.pkml"),
function(x) loadDataSetFromPKML(system.file("extdata", x, package = "ospsuite"))
)
names(obsData) <- lapply(obsData, function(x) x$name)
# Create a new instance of `DataCombined` class
myDataCombined <- DataCombined$new()
# Add simulated results
myDataCombined$addSimulationResults(
simulationResults = simResults,
quantitiesOrPaths = outputPath,
groups = "Aciclovir PVB"
)
# Add observed data set
myDataCombined$addDataSets(obsData$`Vergin 1995.Iv`, groups = "Aciclovir PVB")
calculateResiduals(myDataCombined, scaling = tlf::Scaling$lin)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.