filler_contrasts: Generate filler contrasts

View source: R/hypr.R

filler_contrastsR Documentation

Generate filler contrasts

Description

Fill free degrees of freedom with orthogonal filler contrasts.

Usage

filler_contrasts(x, how.many = nlevels(x), rescale = FALSE)

which_filler(x)

which_target(x)

filler_names(x)

target_names(x)

Arguments

x

A hypr object

how.many

The total number of contrasts for the new hypr object

rescale

If TRUE, the contrast weights will be rescaled

Functions

  • which_filler(): Return indices of filler contrasts

  • which_target(): Return indices of filler contrasts

  • filler_names(): Return names of filler contrasts

  • target_names(): Return names of target contrasts

Examples


# A complete Helmert contrast matrix for 4 levels:
h1 <- hypr(~ (mu2-mu1)/2,
          ~ (mu3-(mu1+mu2)/2)/3,
          ~ (mu4-(mu1+mu2+mu3)/3)/4,
          levels = c("mu1", "mu2", "mu3", "mu4")
          )
cmat(h1)

# An incomplete Helmer contrast matrix (2nd contrast dropped)
h2 <- hypr(~ (mu2-mu1)/2,
           ~ (mu4-(mu1+mu2+mu3)/3)/4,
           levels = c("mu1", "mu2", "mu3", "mu4")
           )
cmat(h2)

# Filling the remaining degree of freedom retrieves the contrast
h3 <- filler_contrasts(h2, rescale = TRUE)
cmat(h3)

stopifnot(all.equal(cmat(h3)[,3], cmat(h1)[,2], check.attributes = FALSE))


hypr documentation built on Nov. 9, 2023, 5:06 p.m.