isOffsetRule: Distinguishes Offset from ordinary rules.

isOffsetRuleR Documentation

Distinguishes Offset from ordinary rules.

Description

An offset rule is one where there is one intercept (beta) parameter for each parent and there is a single slope parameters. As opposed to a regression-style rule where there is a different slope (alpha) for each parent and single intercept. This function distinguishes between the twho types of rules.

Usage

isOffsetRule(rl)
getOffsetRules()
setOffsetRules(newval)

Arguments

rl

A character vector of rule names to test to see if these are offset rules.

newval

A character vector of rule names to be considered as offset rules.

Details

The Compensatory rule acts more or less like a regression, with a slope (or discrimination) parameter for each parent variable, and a single intercept or difficulty parameter. The Conjunctive and Disjunctive follow the same pattern. In contrast the OffsetConjunctive rule, has a different intercept for each parent and a single slope parameter. The OffsetDisjunctive rule follows the same pattern.

The isOffsetRule() is true if the argument references a function which follows the offset parameterization and false if it follow the regression parameterization. Currently it returns true only for “OffsetConjunctive”, and “OffsetDisjunctive”, but using this test should continue to work if the number of rules in CPTtools expands.

The expression getOffsetRules() returns the list of currently known offset-style rules. The function setOffsetRules() allows this list to be manipulated to add a new rule to the list of offset-style rules.

Value

The expression isOffsetRule(rl) returns a logical vector of the same length as rl, with each element TRUE or FALSE depending on whether or the corresponding element of rl is the name of an offset rule. If rl is not a character vector, then the function returns FALSE.

The expression getOffsetRule() returns the names of the current offset rules.

Note

It makes sense in certain situation to use anonymous function objects as rules, however, it is impossible to test whether or not a function is in the offset rule list. Therefore, it is recommended that only rule names be used with this function.

One consequence of this rule is that when given a function argument, isOffsetRule returns FALSE.

Author(s)

Russell G. Almond

See Also

Compensatory, OffsetConjunctive,

Examples


stopifnot(
all(isOffsetRule(c("OffsetConjunctive","Conjunctive"))==c(TRUE,FALSE)),
isOffsetRule(OffsetDisjunctive)==TRUE,
all(getOffsetRules() == c("OffsetConjunctive","OffsetDisjunctive"))
)

setOffsetRules(c(getOffsetRules(),"myOffsetRule"))
stopifnot (isOffsetRule("myOffsetRule"))



ralmond/CPTtools documentation built on Dec. 27, 2024, 7:15 a.m.