[R] using the design matrix to correctly configure contrasts

Karl Brand k.brand at erasmusmc.nl
Fri Jun 4 16:49:49 CEST 2010


Rich, Walmes,

Thank you for enriching my understanding of the concept of 
"interaction": succinctly and clearly explained. I feel i can better 
phrase my question, the context being much clearer now.

In my case, i want to see the simple effects of changing levels of time, 
whilst holding Photperiod and Tissue constant. And i wnat to do this for 
each of the (total) 6 levels of Photoperiod and Tissue.

My poor working knowledge of R leaves me stuck, for now, with the 
default treatment constrasts i get when using the function model.matrix. 
In fact thats been fine, once i decoded the interpretation of the 
colnames of the model.matrix using available examples, at least for 
analyses no more complex than 2-way interactions.

Now im faced with 3 factors, and a model.matrix where i am unble to see 
the constrasts im interested in explictly stated. Does this mean they 
are not possible, ie., i lack enough observations for the contrasts i 
want? If so then i'm still missing some basic concepts of ANOVA.

#I have three photoperiod treatments:

Pperiod <- factor(targets$Pperiod, levels = c("E", "L", "S"))

#Two different tissues were sampled from each* subject:

Tissue <- factor(targets$Tissue, levels = c("R", "C"))

#*Such samples are said to be 'paired', no? Not sure how to deal with
#this, how necessary dealing with it is, or how possible...

#And where 16 unique subjects were sampled (for tissues "R" asnd "C"
# at 16 different times giving the #third factor:

Time <- factor(targets$Time,
                levels = c("1", "2", "3", "4", "5", "6", "7", "8",
                           "9","10","11","12","13","14","15", "16"))

My primary question is- what changes occur across all times for each 
p.period and tissue combination., ie., "ER", "LR", "SR", "EC", "LC" & "SC"?

Contrast wise, this appears straight forward to me for "ER", "LR", "SR" 
& "EC" which are explicit in the model.matrix i get from R (shown again 
below). That is, *assuming* my interpretation of the contrast is correct 
which is what my original post focused on.

But, its just not obvious to me how "LC" and "SC" (for all times) 
contrasts can be specified.

This is my practical problem i'm yet to overcome. And using the package 
"contrast" hasn't helped me overcome this so far (thank you no less Walmes).

Further thoughts and advice gratefully received,

Karl

 > colnames(design)
  [1] "(Intercept)"      "Time2"
  [3] "Time3"            "Time4"
  [5] "Time5"            "Time6"
  [7] "Time7"            "Time8"
  [9] "Time9"            "Time10"
[11] "Time11"           "Time12"
[13] "Time13"           "Time14"
[15] "Time15"           "Time16"
[17] "TissueC"          "PperiodL"
[19] "PperiodS"         "Time2:TissueC"
[21] "Time3:TissueC"    "Time4:TissueC"
[23] "Time5:TissueC"    "Time6:TissueC"
[25] "Time7:TissueC"    "Time8:TissueC"
[27] "Time9:TissueC"    "Time10:TissueC"
[29] "Time11:TissueC"   "Time12:TissueC"
[31] "Time13:TissueC"   "Time14:TissueC"
[33] "Time15:TissueC"   "Time16:TissueC"
[35] "Time2:PperiodL"   "Time3:PperiodL"
[37] "Time4:PperiodL"   "Time5:PperiodL"
[39] "Time6:PperiodL"   "Time7:PperiodL"
[41] "Time8:PperiodL"   "Time9:PperiodL"
[43] "Time10:PperiodL"  "Time11:PperiodL"
[45] "Time12:PperiodL"  "Time13:PperiodL"
[47] "Time14:PperiodL"  "Time15:PperiodL"
[49] "Time16:PperiodL"  "Time2:PperiodS"
[51] "Time3:PperiodS"   "Time4:PperiodS"
[53] "Time5:PperiodS"   "Time6:PperiodS"
[55] "Time7:PperiodS"   "Time8:PperiodS"
[57] "Time9:PperiodS"   "Time10:PperiodS"
[59] "Time11:PperiodS"  "Time12:PperiodS"
[61] "Time13:PperiodS"  "Time14:PperiodS"
[63] "Time15:PperiodS"  "Time16:PperiodS"
[65] "TissueC:PperiodL" "TissueC:PperiodS"




On 6/2/2010 8:26 PM, RICHARD M. HEIBERGER wrote:
> Karl,
>
> The definition and interpretation of contrasts is part of any
> intermediate design of
> experiments text.
> Contrasts for interactions say that the effect of moving
> "from level 1 of A to level 2 of A" depends on the level of B.
> I will use notation YAB to indicate the levels of A and B.
> For example, if
>     (Y11 - Y21) differs from (Y12 - Y22)
> we say that A and B have an interaction.  When A and B interact, then
> the interpretation of "main effects" is ambiguous at best.  Instead,
> we use the concept of simple effects, which, for example, are the
> effects of changing levels of A while holding the levels of B
> constant.
> Interpreting the interactions themselves depends on knowing something
> about the structure of the design, for example whether the effects (A
> and B, here) are treatments, blocks, nested effects, or repeated
> measures.
> Simple effects are usually interpretable.  Interactions are tougher.
> Rich
> <https://mail.google.com/a/temple.edu/?AuthEventSource=SSO#inbox>

-- 
Karl Brand <k.brand at erasmusmc.nl>
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
P +31 (0)10 704 3409 | F +31 (0)10 704 4743 | M +31 (0)642 777 268



More information about the R-help mailing list