contr.FFbased: Full-factorial-based real-valued contrasts for s^el levels

contr.FFbHelmertR Documentation

Full-factorial-based real-valued contrasts for s^el levels

Description

Full-factorial-based real-valued contrasts for s^el levels

Full-factorial-based polynomial contrasts for s^el levels

Usage

contr.FFbHelmert(n, s, contrasts = TRUE, slowfirst = TRUE)

contr.FFbPoly(n, s, contrasts = TRUE, slowfirst = TRUE)

Arguments

n

integer or vector; either an integer number of levels of the factor for which contrasts are created, which must be a a power of s; or a factor whose number of levels is a power of s; or a vector of levels whose number of elements is a power of s.

s

positive integer, at least 2

contrasts

logical; must be TRUE

slowfirst

logical; default TRUE

Details

The functions implement real-valued full-factorial-based contrasts in the sense of Groemping (2023b) that can be used instead of the complex-valued contrasts from Tian and Xu (2022), as implemented in function contr.TianXu. Their main use is the calculation of the stratification pattern (also called space-filling pattern). Function Spattern uses function contr.FFbHelmert for this purpose, the internal function Spattern_Poly uses contr.FFbPoly.

Value

contr.FFbHelmert and contr.FFbPoly yield a matrix of real-valued contrasts. That matrix can be used in function model.matrix or in any statistical modeling functions.

References

Groemping (2023b) Tian and Xu (2022)

Examples

## the same n can yield different contrasts for different s
## Helmert variant
contr.FFbHelmert(16, 2)
round(contr.FFbHelmert(16, 4), 4)
round(contr.FFbHelmert(16, 16), 4)
## Poly variant
contr.FFbHelmert(16, 2)
round(contr.FFbHelmert(16, 4), 4)
round(contr.FFbHelmert(16, 16), 4)


SOAs documentation built on Aug. 11, 2023, 1:09 a.m.