TxpModel-class {toxpiR}R Documentation

ToxPi Model

Description

S4 class to store ToxPi models

Usage

TxpModel(txpSlices, txpWeights = NULL, txpTransFuncs = NULL)

## S4 method for signature 'TxpModel'
txpSlices(x)

## S4 replacement method for signature 'TxpModel'
txpSlices(x) <- value

## S4 method for signature 'TxpModel'
txpWeights(x, adjusted = FALSE)

## S4 replacement method for signature 'TxpModel'
txpWeights(x) <- value

## S4 method for signature 'TxpModel'
txpTransFuncs(x)

## S4 replacement method for signature 'TxpModel'
txpTransFuncs(x) <- value

## S4 method for signature 'TxpModel'
txpValueNames(x, simplify = FALSE)

## S4 method for signature 'TxpModel'
names(x)

## S4 replacement method for signature 'TxpModel'
names(x) <- value

## S4 method for signature 'TxpModel'
length(x)

## S4 method for signature 'TxpModel,TxpModel'
merge(x, y)

Arguments

txpSlices

Passed to txpSlices slot

txpWeights

Passed to txpWeights slot

txpTransFuncs

Passed to txpTransFuncs slot

x, y

TxpModel object

value

Replacement value

adjusted

Scalar logical, should the returned weights be adjusted such that they sum to 1?

simplify

Scalar logical, when TRUE the returned list is simplified

Functions

Slots

txpSlices

TxpSliceList object

txpWeights

numeric vector specifying the relative weight of each slice; when NULL, defaults to 1 (equal weighting) for each slice

txpTransFuncs

TxpTransFuncList object (or list of functions coercible to TxpTransFuncList)

Examples

## Create TxpSliceList & TxpTransFuncList objects
s1 <- list(S1 = TxpSlice("inpt1"), S2 = TxpSlice("inpt2"))
tf <- list(NULL, sqrt = function(x) sqrt(x))

## Create TxpModel object
m1 <- TxpModel(txpSlices = s1, txpWeights = 2:1, txpTransFuncs = tf)
m1

## Access TxpModel slots
txpSlices(m1)
txpWeights(m1)
txpWeights(m1, adjusted = TRUE)
txpTransFuncs(m1)

## length
length(m1) ## equal to length(txpSlices(m1))
length(m1) == length(txpSlices(m1))

## names
names(m1) ## equal to names(txpSlices(m1))
all(names(m1) == names(txpSlices(m1)))

## Replacement
m2 <- m1
txpSlices(m2) <- list(S3 = TxpSlice("inpt3"), S4 = TxpSlice("inpt4"))
m2
names(m2)[2] <- "hello"
names(m2)
txpTransFuncs(m2) <- NULL
m2
txpTransFuncs(m2)[[1]] <- function(x) x^2
names(txpTransFuncs(m2))[1] <- "sq"
m2

## merge
m3 <- merge(m1, m2)
m3

[Package toxpiR version 1.2.1 Index]