Create a Design Matrix

Share:

Description

Create a design matrix for a linear model

Usage

1
  make.design(target, cov, int=NULL)

Arguments

target

a data frame contains chip and covaraite information, or experimental phenotypes recorded in eSet and ExpressionSet-derived classes

cov

a list of 1-n covariates

int

if int=NULL, the interaction effect is not considered; otherwise, use two integers to indicate which covariates are considered for interaction effect. For example, if cov<-c("estrogen","drug","time") and you are considering the interaction between "estrogen" and "time", then you would write int=c(1,3)

Value

a matrix containing design matrix for the linear model

Author(s)

Xiwei Wu xwu@coh.org, Xuejun Arthur Li xueli@coh.org

See Also

make.contrast

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
target<-data.frame(drug=(c(rep("A",4),rep("B",4),rep("C",4))), 
gender=factor(c(rep("M",6),rep("F",6))), 
group=factor(rep(c(1,2,3),4)))
			 
#To create a design matrix using "drug", "gender" as covariates
design1<-make.design(target, c("drug","gender"))
	
#To create a design matrix by using "drug","gender","group" as covariates, 
#and consider the interaction effect of "drug" and "group"
design2<-make.design(target, c("drug","gender", "group"), int=c(1,3))