[BioC] Interaction contrasts with RCBD with replicates

Gordon K Smyth smyth at wehi.EDU.AU
Tue Jul 3 10:10:27 CEST 2012


Hi Daniel,

You're making it more complicated than it needs to be.  You are setting 
Block to be a fixed factor (in the design matrix) and to be a random 
factor (using the block argument) at the same time, but this is not 
permitted.

Just use model.matrix(~TRT*Block), forget about "0+" in the formula and 
forget about duplicate correlation, and then it's all straightforward and 
correct:

   design <- model.matrix(~TRT*Block, pheno.Data)
   fit <- lmFit(eset,design)
   fit <- eBayes(fit)
   topTable(fit, coef=5:6)

Best wishes
Gordon

On Mon, 2 Jul 2012, Daniel [guest] wrote:

>
> Dear all,
>
> I have a RCBD with three treatment levels and two blocks.  Within each 
> block, I have 5 replicates for each treatment (that is, my block size is 
> 15, 5 for each trt level).
>
> I am aware that since I have replicates within the blocks, the 
> denominator for the treatment is supposed to be the treatment by block 
> interaction.
>
> However, the person who I am analyzing the data for is interested in 
> comparing the interaction (block*trt) and I am not quite certain how to 
> setup the model statement in lmFit in this case, so that I can 
> eventually test the interaction.
>
> Does the code below fit the model and tests using the correct residuals 
> (i.e. TRT*Block for TRT and Block, and sqrt(MSE) for TRT*Block)?
>
> design <- model.matrix(~ 0+TRT*Block, pheno.Data)
> correl=duplicateCorrelation(eset, design,block=Block)
> fit <- lmFit(eset,design,block=Block,cor = correl$consensus)
>
> I sincerely appreciate any help I can get.
>
> Thanks,
>
> Daniel
>
> -- output of sessionInfo():
>
>> sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] gcrma_2.28.0        BiocInstaller_1.4.6 car_2.0-12
> [4] nnet_7.3-1          MASS_7.3-18         affy_1.34.0
> [7] Biobase_2.16.0      BiocGenerics_0.2.0  limma_3.12.1
>
> loaded via a namespace (and not attached):
> [1] affyio_1.24.0         Biostrings_2.24.1     IRanges_1.14.3
> [4] preprocessCore_1.18.0 splines_2.15.0        stats4_2.15.0
> [7] zlibbioc_1.2.0
>>
>
> --
> Sent via the guest posting facility at bioconductor.org.
>

______________________________________________________________________
The information in this email is confidential and intend...{{dropped:4}}



More information about the Bioconductor mailing list