fitPoD: PoD curve: fitting function

Description Usage Arguments Details Value Examples

View source: R/FunctionsPoDParameters.R

Description

Function calculates the root mean squared error (RMSE) between provided PoD values and calculated PoD values. The latter are calculated using for provided titers and provided PoD curve parameters.

By using the input titers PoDParamPointEstimation function and median of the estimated set of PoD curve parameters (output of PoDParamEstimation function), the point estimate of PoD curve can be obtained (for details see PoDParamPointEstimation function).

Usage

1
fitPoD(params, TitersInput, CurveTitersMedian)

Arguments

params

named data frame ("pmax", "slope", "et50"): provided PoD curve parameters

TitersInput

numeric vector: provided titers

CurveTitersMedian

numeric vector: provided PoD values

Details

RMSE = sqrt( mean( (PoDmedian(titers) - PoDoptimized(titers))2 ) )

Value

negative RMSE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Data preparation
data(estimatedParameters)
data(PoDParams)

## Example 1

# grid of titers
TitersInput <- seq(from = 0, to = 20, by = 0.01)

# for each estimated PoD curve calculate functional values
functionValues <- 
  matrix(NA, 
         nrow = nrow(estimatedParameters$resultsPriorReset), 
         ncol = length(TitersInput))

for (i in 1:nrow(estimatedParameters$resultsPriorReset)) { 
  functionValues[i,] <- PoD(TitersInput,
  pmax = estimatedParameters$resultsPriorReset[i,1], 
  et50 = estimatedParameters$resultsPriorReset[i,3], 
  slope = estimatedParameters$resultsPriorReset[i,2], adjustTiters = FALSE)
}

# functional values corresponding to the median of the estimated PoD curve parameters
CurveTitersMedian <- apply(functionValues, 2, median)

# squared error of CurveTitersMedian and functional values of "params" curve
fitPoD(PoDParams, TitersInput, CurveTitersMedian)

PoDBAY documentation built on Sept. 21, 2021, 5:08 p.m.