contrastModel: Create transformed model matrix for contrast rotation

Description Usage Arguments Details Value Author(s) Examples

View source: R/randRot.R

Description

This function takes a model matrix X and a contrast matrix C and creates a transformed model matrix corresponding to a transformed set of coefficients.

Usage

1
contrastModel(X, C, coef.h = seq_len(ncol(C)))

Arguments

X

(numeric) model matrix with dimensions samples x coefficients.

C

(numeric) contrast matrix with dimensions coefficients x contrasts. The contrast matrix must have full column rank.

coef.h

column numbers of contrasts (in C) which should be set as coef.h in the transformed model, see initRandrot. All columns are set as coef.h by default.

Details

The last n coefficients of the transformed model matrix correspond to the n contrasts. By default, all contrasts are set as coef.h. See package vignette for examples of data rotations with contrasts.

Value

A transformed model matrix with coef.h set as attribute.

Author(s)

Peter Hettegger

Examples

1
2
3
4
group <- c("A", "A", "B", "B")
X <- model.matrix(~0+group)
C <- cbind(contrast1 = c(1, -1))
X2 <- contrastModel(X, C)

randRotation documentation built on April 14, 2021, 6:01 p.m.