It's stated in the MAST intro documentation that it supports a full linear model to support arbitrary comparisons, etc. Does this extend as far as appropriately modeling ordered factors? If we were to analyze dose-response data should we use ordered factors to model those doses? We'd like to test for dose-responsive differential expression of genes. Is there a more appropriate way to model these data?
First off, in base R, I have only dabbled with the ordered factor contrasts so don't know them well enough to give reliable advice about how to interpret them. That being said, there are two ways to apply them with MAST.
First, you can set the
contrasts attribute to the column of interest:
library(MAST) data(vbetaFA) table(colData(vbetaFA)$Time) # 0 3 6 12 # 91 94 94 177 contrasts(colData(vbetaFA)$Time) = 'contr.poly' zz = zlm(~Time, sca = vbetaFA) summary(zz)
[Note: AFAIK, you need evenly spaced factor levels for the polynomial contrasts to be interpretable.]
Second, you can use dummy coding, and then cook up whatever contrast you like to test with
contrasts(colData(vbetaFA)$Time) = 'contr.treatment' zz = zlm(~Time+0, sca = vbetaFA) cntr1 = Hypothesis("Time0-Time3") cntr2 = Hypothesis("2*Time6-Time0-Time3") lrTest(zz, cntr1) lrTest(zz, cntr2)
Although testing is relatively easy in this case, there's some functionality missing to easily derive the coefficient estimates.