Learn R Programming

infoDecompuTE (version 0.5.1)

getIncidenceMatrix: Get the Treatment Incidence Matrix

Description

Construct the treatment incidence matrix base on the experimental design.

Usage

getIncidenceMatrix(design.df, trtCols)

Arguments

design.df
a data frame containing the design of the experiment. Every column must be factors.
trtCols
a list of treatment terms generated from the terms function.

Value

This function returns a matrix describing the design of overall treatment structure.

Examples

Run this code
 design1 <- local({ 
    Ani = as.factor(LETTERS[c(1,2,3,4,
                              5,6,7,8)])
    Trt = as.factor(letters[c(1,1,1,1,
                              2,2,2,2)])
    data.frame(Ani, Trt)
  })

  trt.str = "Trt"
  
  	fT = terms(as.formula(paste("~", trt.str, sep = "")), keep.order = TRUE)  #fixed terms

	trtTerm = attr(fT,"term.labels")
		effectsMatrix = attr(fT,"factor") 
    
	N =  getIncidenceMatrix(design1, trtTerm)
       

Run the code above in your browser using DataLab