testRelation {socialranking}R Documentation

Test relation between two elements

Description

On a given PowerRelation object pr, check if e1 relates to e2 based on the given social ranking solution.

Usage

testRelation(powerRelation, e1)

powerRelation %:% e1

pr_e1 %>=dom% e2

pr_e1 %>dom% e2

pr_e1 %>=cumuldom% e2

pr_e1 %>cumuldom% e2

pr_e1 %>=cp% e2

pr_e1 %>cp% e2

pr_e1 %>=banz% e2

pr_e1 %>banz% e2

pr_e1 %>=cop% e2

pr_e1 %>cop% e2

pr_e1 %>=ks% e2

pr_e1 %>ks% e2

pr_e1 %>=lex% e2

pr_e1 %>lex% e2

pr_e1 %>=duallex% e2

pr_e1 %>duallex% e2

pr_e1 %>=L1% e2

pr_e1 %>L1% e2

pr_e1 %>=L2% e2

pr_e1 %>L2% e2

pr_e1 %>=LP% e2

pr_e1 %>LP% e2

pr_e1 %>=LPS% e2

pr_e1 %>LPS% e2

Arguments

powerRelation

A PowerRelation object created by PowerRelation() or as.PowerRelation()

e1, e2

Elements in powerRelation$elements

pr_e1

PowerRelation and e1 element, packed into a list using pr %:% e1

Details

The function testRelation is somewhat only used to make the offered comparison operators in the package better discoverable.

testRelation(pr, e1) is equivalent to pr %:% e1 and list(pr, e1). It should be used together with one of the comparison operators listed in the usage section.

Value

testRelation() and ⁠%:%⁠ returns list(powerRelation, e1).

Followed by a ⁠%>=comparison%⁠ or ⁠%>comparison%⁠ it returns TRUE or FALSE, depending on the relation between e1 and e2.

See Also

Comparison function: dominates(), cumulativelyDominates(), cpMajorityComparison().

Score Functions: ordinalBanzhafScores(), copelandScores(), kramerSimpsonScores(), lexcelScores().

Examples

pr <- as.PowerRelation("123 > 12 ~ 13 ~ 23 > 3 > 1 ~ 2 > {}")

# Dominance
stopifnot(pr %:% 1 %>=dom% 2)

# Strict dominance
stopifnot((pr %:% 1 %>dom% 2) == FALSE)

# Cumulative dominance
stopifnot(pr %:% 1 %>=cumuldom% 2)

# Strict cumulative dominance
stopifnot((pr %:% 1 %>cumuldom% 2) == FALSE)

# CP-Majority relation
stopifnot(pr %:% 1 %>=cp% 2)

# Strict CP-Majority relation
stopifnot((pr %:% 1 %>cp% 2) == FALSE)

# Ordinal banzhaf relation
stopifnot(pr %:% 1 %>=banz% 2)

# Strict ordinal banzhaf relation
# (meaning 1 had a strictly higher positive contribution than 2)
stopifnot((pr %:% 1 %>banz% 2) == FALSE)

# Copeland-like method
stopifnot(pr %:% 1 %>=cop% 2)
stopifnot(pr %:% 2 %>=cop% 1)

# Strict Copeland-like method
# (meaning pairwise winning minus pairwise losing comparison of
# 1 is strictly higher than of 2)
stopifnot((pr %:% 1 %>cop% 2) == FALSE)
stopifnot((pr %:% 2 %>cop% 1) == FALSE)
stopifnot(pr %:% 3 %>cop% 1)

# Kramer-Simpson-like method
stopifnot(pr %:% 1 %>=ks% 2)
stopifnot(pr %:% 2 %>=ks% 1)

# Strict Kramer-Simpson-like method
# (meaning ks-score of 1 is actually higher than 2)
stopifnot((pr %:% 2 %>ks% 1) == FALSE)
stopifnot((pr %:% 1 %>ks% 2) == FALSE)
stopifnot(pr %:% 3 %>ks% 1)

# Lexicographical and dual lexicographical excellence
stopifnot(pr %:% 3 %>=lex% 1)
stopifnot(pr %:% 3 %>=duallex% 1)

# Strict lexicographical and dual lexicographical excellence
# (meaning their lexicographical scores don't match)
stopifnot(pr %:% 3 %>lex% 1)
stopifnot(pr %:% 3 %>duallex% 1)

# L^(1) and L^(2)
stopifnot(pr %:% 1 %>=L1% 2)
stopifnot(pr %:% 1 %>=L2% 2)

# Strict L^(1) and L^(2)
stopifnot((pr %:% 1 %>L1% 2) == FALSE)
stopifnot(pr %:% 3 %>L1% 1)

stopifnot((pr %:% 1 %>L2% 2) == FALSE)
stopifnot(pr %:% 3 %>L2% 1)

# L^p and L^p*
stopifnot(pr %:% 1 %>=LP% 2)
stopifnot(pr %:% 1 %>=LPS% 2)

# Strict L^(1) and L^(2)
stopifnot((pr %:% 1 %>LP% 2) == FALSE)
stopifnot(pr %:% 3 %>LP% 1)

stopifnot((pr %:% 1 %>LPS% 2) == FALSE)
stopifnot(pr %:% 3 %>LPS% 1)


[Package socialranking version 1.2.0 Index]