Skip to contents

Calculate ToxPi Scores for the given model and input data

Usage

txpCalculateScores(model, input, ...)

# S4 method for class 'TxpModel,data.frame'
txpCalculateScores(
  model,
  input,
  id.var = NULL,
  rank.ties.method = c("average", "first", "last", "random", "max", "min"),
  negative.value.handling = c("keep", "missing")
)

# S4 method for class 'TxpModelList,data.frame'
txpCalculateScores(
  model,
  input,
  id.var = NULL,
  rank.ties.method = c("average", "first", "last", "random", "max", "min"),
  negative.value.handling = c("keep", "missing")
)

# S4 method for class 'list,data.frame'
txpCalculateScores(
  model,
  input,
  id.var = NULL,
  rank.ties.method = c("average", "first", "last", "random", "max", "min"),
  negative.value.handling = c("keep", "missing")
)

Arguments

model

TxpModel object or TxpModelList object

input

data.frame object containing the model input data

...

Included for extendability; not currently used

id.var

Character scalar, column in 'input' to store in

rank.ties.method

Passed to rank.ties.method slot

negative.value.handling

Passed to negative.value.handling slot

Value

TxpResult or TxpResultList object

Details

txpCalculateScores is implemented as an S4 generic function with methods for TxpModel and TxpModelList.

Ranks are calculated such that the highest ToxPi score has a rank of 1.

Missingness is determined after applying input-level transformations but before applying slice-level transformations.

Examples

## Load example dataset & model; see ?TxpModel for building model objects
data(txp_example_input, package = "toxpiR")
data(txp_example_model, package = "toxpiR")

## Calculate scores for single model; returns TxpResult object
res <- txpCalculateScores(model = txp_example_model, 
                          input = txp_example_input, 
                          id.var = "name")

## Calculate scores for list of models; returns TxpResultList object
txpCalculateScores(model = TxpModelList(m1 = txp_example_model, 
                                        m2 = txp_example_model), 
                   input = txp_example_input, 
                   id.var = "name")
#>   TxpResultList of length 2: m1 m2
resLst <- txpCalculateScores(model = list(m1 = txp_example_model, 
                                          m2 = txp_example_model), 
                             input = txp_example_input, 
                             id.var = "name")