MultiLinearModel-class | R Documentation |
Class to fit multiple (row-by-row) linear (fixed-effects) models on microarray or proteomics data.
MultiLinearModel(form, clindata, arraydata)
## S4 method for signature 'MultiLinearModel'
summary(object, ...)
## S4 method for signature 'MultiLinearModel'
as.data.frame(x, row.names=NULL, optional=FALSE, ...)
## S4 method for signature 'MultiLinearModel'
hist(x, xlab='F Statistics', main=NULL, ...)
## S4 method for signature 'MultiLinearModel,missing'
plot(x, y, ylab='F Statistics', ...)
## S4 method for signature 'MultiLinearModel,ANY'
plot(x, y, xlab='F Statistics',
ylab=deparse(substitute(y)), ...)
## S4 method for signature 'MultiLinearModel'
anova(object, ob2, ...)
multiTukey(object, alpha)
form |
|
clindata |
either a data frame of "clinical" or other
covariates, or an |
arraydata |
matrix or data frame of values to be explained by the model.
If |
object |
object of class |
ob2 |
object of class |
x |
object of class |
y |
optional numeric vector |
xlab |
character string specifying label for the x-axis |
ylab |
character string specifying label for the y-axis |
main |
character string specifying graph title |
... |
extra arguments for generic or plotting functions |
row.names |
see the base version |
optional |
see the base version |
alpha |
numeric scalar between |
The anova
method returns a data frame. The rows in the data
frame corresponds to the rows in the arraydata
object that was
used to construct the MultiLinearModel
objects. The first
column contains the F-statistics and the second column contains the
p-values.
The multiTukey
function returns a vector whose length equals
the number of rows in the arraydata
object used to construct
the MultiLinearModel
. Assuming that the overall F-test was
significant, differences in group means (in each data row) larger than
this value are significant by Tukey's test for honestly significant
difference. (Of course, that statement is incorrect, since we haven't
fully corrected for multiple testing. Our standard practice is to take
the p-values from the row-by-row F-tests and evaluate them using the
beta-uniform mixture model (see Bum
). For the rows that
correspond to models whose p-values are smaller than the Bum
cutoff, we simply use the Tukey HSD values without further
modification.)
Objects should be created by calling the MultiLinearModel
function. The first argument is a formula
specifying
the linear model, in the same manner that it would be passed to
lm
. We will fit the linear model separately for each
row in the arraydata
matrix. Rows of arraydata
are
attached to the clindata
data frame and are always referred to
as "Y" in the formulas. In particular, this implies that
clindata
can not include a column already called "Y". Further,
the implementation only works if "Y" is the response variable in the model.
The BioConductor packages uses an ExpressionSet
to combine microarray
data and clinical covariates (known in their context as
phenoData
objects) into a single structure.
You can call MultiLinearModel
using an ExpressionSet
object
for the clindata
argument. In this case, the function extracts
the phenoData
slot of the ExpressionSet
to use for the
clinical covariates, and extracts the exprs
slot of the
ExpressionSet
object to use for the array data.
call
:A call
object describing how the object
was constructed.
model
:The formula
object specifying the linear
model.
F.statistics
:A numeric vector of F-statistics comparing the linear model to the null model.
p.values
:A numeric vector containing the p-values associated to the F-statistics.
coefficients
:A matrix
of the coefficients in
the linear models.
predictions
:A matrix
of the (Y-hat) values
predicted by the models.
sse
:A numeric vector of the sum of squared error terms from fitting the models.
ssr
:A numeric vector of the sum of squared regression terms from the model.
df
:A numeric vector (of length two) containing the degrees of freedom for the F-tests.
Write out a summary of the object.
Create a histogram of the F-statistics.
Plot the F-statistics as a function of the row index.
Plot the F-statistics against the numeric vector y
.
Perform row-by-row F-tests comparing two different linear models.
The MultiLinearModel
constructor computes row-by-row F-tests
comparing each linear model to the null model Y ~ 1. In many
instances, one wishes to use an F-test to compare two different linear
models. For instance, many standard applications of analysis of
variance (ANOVA) can be described using such a comparison between two
different linear models. The anova
method for the
MultiLinearModel
class performs row-by-row F-tests comparing
two competing linear models.
The implementation of MultiLinearModel
does not take the naive
approach of using either apply
or a
for
-loop to attach rows one at a time and fit separate
linear models. All the models are actually fit simultaneously by a
series of matrix operations, which greatly reduces the amount of time
needed to compute the models. The constraint on the column names in
clindata
still holds, since one row is attached to allow
model.matrix
to determine the contrasts matrix.
Kevin R. Coombes krc@silicovore.com
anova
,
lm
,
Bum
,
MultiTtest
,
MultiWilcoxonTest
showClass("MultiLinearModel")
ng <- 10000
ns <- 50
dat <- matrix(rnorm(ng*ns), ncol=ns)
cla <- factor(rep(c('A', 'B'), 25))
cla2 <- factor(rep(c('X', 'Y', 'Z'), times=c(15, 20, 15)))
covars <- data.frame(Grade=cla, Stage=cla2)
res <- MultiLinearModel(Y ~ Grade + Stage, covars, dat)
summary(res)
hist(res, breaks=101)
plot(res)
plot(res, res@p.values)
graded <- MultiLinearModel(Y ~ Grade, covars, dat)
summary(graded)
hist(graded@p.values, breaks=101)
hist(res@p.values, breaks=101)
oop <- anova(res, graded)
hist(oop$p.values, breaks=101)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.