Hi all I have an experiment where I would like to do a 2x2 design for experiment with two conditions. Knockdown of the pk gene with or without serum. What I would like to find out are genes with main effect of pk knockdown, main effect of serum and interaction. My target table looks something like this.
sample gene condition
1 control serum
2 pk_minus serum
...
15 control serum_minus
16 pk_minus serum_minus
-
I found a tutorial online and tried to replicated as such.
ft <- paste(targetst$condition,targetst$gene,sep="")
ft <- factor(ft)
ft
design2 <- model.matrix(~0+ft)
colnames(design2) <- levels(ft)
design2
cont.matrix <- makeContrasts(
pk="serumpk_minus-serumcontrol",
pk_minus="serum_minuspk_minus-serum_minuscontrol",
serum="serumcontrol-serum_minuscontrol",
no_serum = "serum_minuspk_minus-serum_minuscontrol",
Interaction="(serumpk_minus-serum_minuspk_minus) - (serumshcontrol-serum_minuscontrol)"
,levels=design)
fit <- lmFit(data, design2)
fit2 <- contrasts.fit(fit, cont.matrix)
fit2 <- eBayes(fit2)
With this is it correct to assume that coef 5 is the interaction? What if I wanted a main effect of serum?
Would it be better if I just do a 2-way ANOVA instead? thanks in advance.
Ahdee
James, did you mean:
This would compute the serum difference while averaging over the
pk_minus
effect.Edit: Probably need to divide both groups by 2 as well, to get the average.
Yes! So if you pk_minus all my errors and add a divide by two, what I really meant is what Aaron says. ;-D
Thanks so much Aaron and James, so in light of what you wrote, is this correct?
serum_main = (serumpk_minus + serumcontrol)/2 - (serum_minuspk_minus + serum_minuscontrol)/2
pk_main = (serumpk_minus + serum_minuspk_minus)/2 - (serumcontrol + serumpk_minus)/2
interaction (serumpk_minus-serum_minuspk_minus) - (serumshcontrol-serum_minuscontrol)
thank you!
Ahdee
No, algebraically your serum_main and pk_main are the same thing (well, except for the sign of the coefficient). But the interaction is fine.
shoot I guess I just don't understand this. In that case, how would the pk_main look like? thanks in advance.
Actually, your initial definition of
pk_main
is not equivalent toserum_main
, but instead cancels out algebraically to giveserum_minuspk_minus/2 - serumcontrol/2
, which doesn't really mean anything. Instead, if you want to get the genotype "main effect", you should be defining:This should give you the difference between
pk_minus
andcontrol
, averaged over the serum effect in each genotype. I can't speak for James, but I'm finding your group names quite hard to read because of the repeated instances of*_minus
- I'm having to spend quite a bit of time double-checking everything.yes realized that too; so sorry for that - thanks for taking the time to help me. I also ran a traditional 2-way and it really works out, p value not exactly the same but close enough. One advantage for 2-way with the ez package is what I'm able to choose between or within measurements. thanks in advance to both of you! you rock.
woohoo
Also, to elaborate on James' answer; the
serum
contrast you have tests for the effect of the serum in control cells only. If you want to test for the effect of the serum inpk_minus
cells, you'd have to do:If, for a particular gene, the effect of the serum in control cells is substantially different from that in
pk_minus
cells, then the concept of a "serum main effect" would have no meaning. For example, you would get a positive main effect fromserum_main
if treatment with serum causes a large upregulation in control cells but a smaller downregulation inpk_minus
cells. This would be misleading for both genotypes, as it understates the change in one and gets the incorrect direction in the other. It would really only make sense to test for a serum main effect for genes that have a non-significant result for theInteraction
contrast.