| sbp_basis | R Documentation |
Construct a balance basis from a sequential binary partition (SBP) or from a more general collection of balances.
sbp_basis(sbp, data = NULL, fill = FALSE, silent = FALSE)
sbp |
A list of formulas or a matrix describing balances. |
data |
Optional compositional data set used to extract part names when 'sbp' is given as a list of formulas. |
fill |
Logical; if 'TRUE', complete the supplied balances to obtain a full basis. |
silent |
Logical; if 'FALSE', report whether the resulting balances form a basis, and whether they are orthogonal or orthonormal. |
The argument 'sbp' can be specified in two ways:
as a list of formulas, where each formula defines the numerator and the denominator groups of a balance,
as a matrix with one column per balance and one row per part. Positive entries indicate parts in the numerator, negative entries indicate parts in the denominator, and zeros indicate unused parts.
A matrix whose columns are balances.
X <- data.frame(
a = 1:2, b = 2:3, c = 4:5,
d = 5:6, e = 10:11, f = 100:101, g = 1:2
)
# Sequential SBP construction
sbp_basis(list(
b1 = a ~ b + c + d + e + f + g,
b2 = b ~ c + d + e + f + g,
b3 = c ~ d + e + f + g,
b4 = d ~ e + f + g,
b5 = e ~ f + g,
b6 = f ~ g
), data = X)
# Chain construction
sbp_basis(list(
b1 = a ~ b,
b2 = b1 ~ c,
b3 = b2 ~ d,
b4 = b3 ~ e,
b5 = b4 ~ f,
b6 = b5 ~ g
), data = X)
# Non-orthogonal system of balances
sbp_basis(list(
b1 = a + b + c ~ e + f + g,
b2 = d ~ a + b + c,
b3 = d ~ e + g,
b4 = a ~ e + b,
b5 = b ~ f,
b6 = c ~ g
), data = X)
# Direct construction from a contrast matrix
sbp_basis(cbind(
c( 1, 1, -1, -1),
c( 1, -1, 1, -1),
c( 1, -1, -1, 1)
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.