d_ab2i: Convert contrast indexing

Description Usage Arguments Value Functions Note Examples

View source: R/indexing.R

Description

Functions for converting between d_{ab} indexing of contrasts (useful notationally) and d[i] indexing used by R.

Usage

1
2
3
d_ab2i(a, b, K)

d_i2ab(i, K)

Arguments

a

Vector of treatment codes a.

b

Vector of treatment codes b.

K

Total number of treatments.

i

Vector of indices i.

Value

d_ab2i returns a vector of indices i. d_i2ab returns a data frame of indices a and b.

Functions

Note

By convention, 1 ≤ a < b ≤ K. If this is not the case, an error will be thrown. For a given number of treatments K, the total number of possible contrasts d_{ab} is K(K-1)/2, and hence i ≤ K. Again, if this is not the case, an error will be thrown.

Examples

1
2
d_ab2i(c(1,1,1, 2,2, 3), c(2,3,4, 3,4, 4), K=4)
d_i2ab(1:6, K=4)

nmathresh documentation built on July 8, 2020, 5:17 p.m.