[BioC] Two-way ANOVA with multtest's MTP/EBMTP

Neil Gray nag2103 at columbia.edu
Thu Jan 20 22:42:09 CET 2011


Hi Jim,
Thanks for your help, but I'm still having some trouble.  The format 
seems to be correct, but I keep getting an error:

 > y = paste(rep(c("pF","pS"), each=6),rep(c("aF","aS"), each=3, 
times=2),sep="")
 > yf = factor(y)
 > yf
  [1] pFaF pFaF pFaF pFaS pFaS pFaS pSaF pSaF pSaF pSaS pSaS pSaS
Levels: pFaF pFaS pSaF pSaS
 > m = 
MTP(exset,Y=yf,test='f.twoway',B=100,typeone='fdr',nulldist='boot.ctr',method='sd.minP',alpha=0.05)
Error in rep(x, BlockNum[x]) : invalid 'times' argument

 > traceback()
9: FUN(1L[[1L]], ...)
8: lapply(X, FUN, ...)
7: sapply(1:l, function(x) rep(x, BlockNum[x]))
6: unlist(sapply(1:l, function(x) rep(x, BlockNum[x])))
5: FUN(newX[, i], ...)
4: apply(X, MARGIN, FUN, ...)
3: wapply(X, 1, stat.closure, W)
2: get.Tn(X, stat.closure, W)
1: MTP(exset, Y = yf, test = "f.twoway", B = 100, typeone = "fdr",
        nulldist = "boot.ctr", method = "sd.minP", alpha = 0.05)

I feel like I must be missing something obvious here, but I've tried 
organizing the group data in a number of ways...

Neil

On 1/19/11 5:37 PM, James W. MacDonald wrote:
> Hi Neil,
>
> On 1/19/2011 4:12 PM, Neil Gray wrote:
>> Hello - hopefully a quick question here. I've been using the MTP and
>> EBMTP functions for multiple testing correction of microarray expression
>> data. I've had no problems using the t-test option, but my overall
>> design is a two-factor ANOVA (2x2 groups using two different
>> treatments). My eSet therefore has two phenoData slots, and while it's
>> easy enough to specify one or the other, e.g., test='t.twosamp.equalvar'
>> and Y='treatment1', but I don't understand how to specify the 2x2 design
>> for test='f.twoway'. It seems Y can't be a matrix, and it can only be of
>> length equal to the number of samples.
>
> Yes. From ?MTP:
>
> Y: A vector, factor, or 'Surv' object containing the outcome of
>           interest. This may be class labels (F-tests and two sample
>           t-tests) or a continuous or polycotomous dependent variable
>           (linear regression based t-tests), or survival data (Cox
>           proportional hazards based t-tests). For 'block.f' and
>           'f.twoway' tests, class labels must be ordered by block and
>           within each block ordered by group. If 'X' is an
>           ExpressionSet, 'Y' can be a character string referring to the
>           column of 'pData(X)' to use as outcome. Default is 'NULL'.
>
> So for f.twoway, you need a factor, with the class labels ordered 
> correctly.
>
> Let's say you have something like this:
>
> > trt <- rep(c("trt","untrt"), each=6)
> > typ <- rep(c("wt","ko"), each=3, times=2)
> > cbind(trt,typ)
>       trt     typ
>  [1,] "trt"   "wt"
>  [2,] "trt"   "wt"
>  [3,] "trt"   "wt"
>  [4,] "trt"   "ko"
>  [5,] "trt"   "ko"
>  [6,] "trt"   "ko"
>  [7,] "untrt" "wt"
>  [8,] "untrt" "wt"
>  [9,] "untrt" "wt"
> [10,] "untrt" "ko"
> [11,] "untrt" "ko"
> [12,] "untrt" "ko"
>
> To get the factor, I believe you need something like this:
>
> > my.y <- factor(paste(trt,typ, sep = ""))
> > my.y
>  [1] trtwt   trtwt   trtwt   trtko   trtko   trtko   untrtwt untrtwt 
> untrtwt
> [10] untrtko untrtko untrtko
> Levels: trtko trtwt untrtko untrtwt
>
> Does that make sense?
>
> Best,
>
> Jim
>
>



More information about the Bioconductor mailing list