Learn R Programming

lava (version 1.4.7)

contr: Create contrast matrix

Description

Create contrast matrix typically for use with 'estimate' (Wald tests).

Usage

contr(p, n, change.sign = TRUE, ...)

Arguments

p
index of non-zero entries (see example)
n
Total number of parameters (if omitted the max number in p will be used)
change.sign
If FALSE all non-zero entries are +1, otherwise the second non-zero element in each row will be -1.
...
Additional arguments to lower level functions

Examples

Run this code
contr(2,n=5)
contr(as.list(2:4),n=5)
contr(list(1,2,4),n=5)
contr(c(2,3,4),n=5)
contr(list(c(1,3),c(2,4)),n=5)
contr(list(c(1,3),c(2,4),5))

Run the code above in your browser using DataLab