Question: Help with 2x2 factorial for using LIMMA
0
4.0 years ago by
Ahdee40
United States
Ahdee40 wrote:

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

limma limma design matrix • 627 views
modified 4.0 years ago by James W. MacDonald51k • written 4.0 years ago by Ahdee40
Answer: Help with 2x2 factorial for using LIMMA
3
4.0 years ago by
United States
James W. MacDonald51k wrote:

A conventional main effect for serum computes the difference between samples with and without serum, after controlling for pk_minus (whatever that is) in the samples that have that treatment. The 'serum' contrast you are computing already is probably pretty close to what you would get for a serum main effect. You could also do

serum_main = (serum_minuspk + serumcontrol) - (serum_minuspk_minus + minuscontrol)

but that would be the effect of serum while ignoring the effect of pk_minus.

Whether or not just doing a factorial model (which is what I think you mean by a 2-way ANOVA) is better depends on what you care to know. The interaction term will be the same, regardless, but it's harder to get at the other comparisons you are making.

1

James, did you mean:

serum_main = (serumpk_minus + serumcontrol)/2 - (serum_minuspk_minus + serum_minuscontrol)/2

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.

1

Actually, your initial definition of pk_main is not equivalent to serum_main, but instead cancels out algebraically to give serum_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:

pk_main = (serumpk_minus + serum_minuspk_minus)/2 - (serumcontrol + serum_minuscontrol)/2

This should give you the difference between pk_minus and control, 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

1

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 in pk_minus cells, you'd have to do:

serum.pk_minus = serumpk_minus - serum_minuspk_minus

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 from serum_main if treatment with serum causes a large upregulation in control cells but a smaller downregulation in pk_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 the Interaction contrast.