Get the Treatment Coefficient

Share:

Description

Compute the overall treatment coefficients.

Usage

1
getTrtCoef(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 the numeric vector.

Author(s)

Kevin Chang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 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") 
		
		trt.Coef = getTrtCoef(design1, trtTerm)