I am trying to analyse microarray data from samples with the following characteristics: one of two genotypes, a procedure either carried out or not carried out, and, in the case that the procedure is carried out, the treatment can either be a drug or a negative control.

My design matrix, therefore, has three columns: genotype, procedure, and treatment. What I don't understand is how to construct the design matrix such that contrasts be extracted. Most online guides recommend that the design matrix be transformed into factors, but, since all of my variables have only two values, the two factor columns that come out will necessarily be linearly dependent, which means that the linear fit will come back with a warning saying that not all variables could be modelled. On the other hand, if I leave the design matrix as is—i.e., with three columns of 0/1 variables—how do I create the contrast matrix if there is no subtraction for the makeContrasts() function that can compare genotype == 0 with genotype == 1, for example?

  • $\begingroup$ When you say it will come back, have you actually tried it? I think R is smarter than you give it credit for. $\endgroup$ – mdewey Jul 14 '16 at 20:40
  • $\begingroup$ Yep, I have tried it and there are basically two options in the end: either you let it create a strange design matrix where it doesn't have every possible level for each variable, or you define the design matrix and then it complains about many of the columns being representative of unestimable coefficients :/ $\endgroup$ – JCCS Jul 15 '16 at 0:47
  • $\begingroup$ Well that is inevitable. There are only so many linearly independent columns. You can play around with which ones you have but you cannot exceed the limit. $\endgroup$ – mdewey Jul 15 '16 at 7:57
  • $\begingroup$ Can you elaborate on that? I don't quite understand what you mean. $\endgroup$ – JCCS Jul 15 '16 at 20:22
  • $\begingroup$ You have eight means (or possibly only six as the design may not be a full factorial one). That means there are only eight independent things you can say about the means (or six). $\endgroup$ – mdewey Jul 16 '16 at 12:39

To clarify things here consider a study where you weigh men and women. You could report

Men weigh on average 80kg and women weigh 70kg

The average weight of a person is 75kg and men are 10kg heavier than women

In each case there are two independent facts. You cannot add a third which is independent of them. In your case you are trying to do just that and it is not possible.

| cite | improve this answer | |
  • $\begingroup$ I agree completely, but I'm still not sure how that applies to my problem? It doesn't appear to me that I'm asking too many questions of the data. Let's say we're looking for (significant) differences in weight when men versus women are given a drug versus a control, and we have some number of replicates for each of those four combinations of attributes. What is the design matrix and what is the contrast matrix? $\endgroup$ – JCCS Jul 21 '16 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.