Design matrix for 2x2 factorial
In this 2x2 factorial experiment to investigate the effect of drought on tree growth, 2 different types of Populus tree were grown with 2 different amounts of water. In order to have one model coefficient per group, you need to first combine the two variables.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Differential Expression Analysis with limma in R
คำแนะนำการฝึกหัด
The ExpressionSet object eset with the Populus data has been loaded in your workspace.
Combine the variables
type(the type of tree) andwater(normal vs. drought) into a single factor variable.Use
model.matrixto create a design matrix with no intercept.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Create single variable
group <- with(___(eset), paste(___, ___, sep = "."))
group <- factor(group)
# Create design matrix with no intercept
design <- model.matrix(~___ + ___)
colnames(design) <- levels(group)
# Count the number of samples modeled by each coefficient
colSums(design)