Learn R Programming

adoptr (version 0.1.1)

AffineScore-class: Affine functions of scores

Description

The AffineScore class implements simple affince functions of both ConditionalScore and UnconditionalScore objects respectively.

Usage

AffineScore(scores, coefs, intercept)

# S4 method for AffineScore show(object)

AffineUnconditionalScore(scores, coefs, intercept = 0)

AffineConditionalScore(scores, coefs, intercept = 0)

Arguments

scores

cf. corresponding slot

coefs

cf. corresponding slot

intercept

cf. corresponding slot

object

object of class AffineScore

...

further optional arguments

Slots

scores

the list of scores

coefs

numeric vector of the same length as scores, holding the coefficients

intercept

the intercept for the affine function

AffineScore allows to add scores of arbitrary class and shift them by the intercept.

AffineUnconditionalScore allows the same for scores of class UnconditionalScore and AffineConditionalScore for scores of class ConditionalScore. By the methods + and * scores can be added and multiplicated, respectively. Note that it is not possible to use these methods for a mixture of ConditionalScore and UnconditionalScore as these require different evaluation techniques. However, for both score classes multiplication and addition with numerics is provided.

Examples

Run this code
# NOT RUN {
# shift score AverageN2() by 10 and multiply by factor 2
affine_avn2 <- 2 * AverageN2() + 10

# shift conditional sample size by 5 and divide by 2
aff_css <- 0.5 * ConditionalSampleSize(Normal(), PointMassPrior(.25, 1)) + 5

# }

Run the code above in your browser using DataLab