# 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))
Run the code above in your browser using DataLab