This function computes the Locally Moderated Weighted-t statistic (LMW) described in $A$strand (2007b), thus calculating
locally moderated weighted t-statistic, p-value and log2(FC) for each row of the data matrix x.Each gene g (row of x) is modeled as:
$$y_g|c_g \sim N(\mu_g,c_g\Sigma)$$
$$c_g \sim \mbox{InvGamma}(m/2,m\nu/2)$$
where $v$ is function of the mean intensity: $v(mean(mu_g))$,
$N$ denotes a multivariate normal distribution,
$Sigma$ is a covariance matrix and
$InvGamma(a,b)$ is the inverse-gamma distribution with density function
$$f(x)=(b)^{a} \exp\{-b/x\} x^{-a-1}/\Gamma(a)$$
Given the design matrix D, $mu_g$ equals $D*gamma_g$,
and given the contrast matrix C the hypothesis $C*gamma_g=0$ is tested.
C should be a one row matrix of same length as the column vector $gamma_g$.
See examples on how to specify the design and contrast matrices.
A cubic spline is used to parameterize the smooth function $v(x)$
$$\nu(x) = \exp\{ H(x)^T \beta \}$$
where
$H:R->R^(2p-1)$
is a set B-spline basis functions for a given set of p interior spline-knots, see chapter 5 of Hastie et al. (2001).
For details about the model see Kristiansson et al. (2005), $A$strand et al. (2007a,2007b).
As specified above, $v$ is modeled as a function of mean intensity: $v(mean(mu_g))$.
If the parameter meanX is not NULL, meanX is used instead of the mean intensity when modeling $v$.
Thus, if meanX is not NULL, meanX must be a vector of length equal to the number of rows of the data matrix x.
The parameter estimation procedure is based on the assumption that the specified contrast is close to zero
for most genes, or at least that the median contrast over all genes is close to zero. A check is run on data
to validate this assumptions. If the checking fails, with the error message "warning: most genes appears to be regulated..."
and if YOU ARE SURE that the design and contrast is correct, use checkRegulation=FALSE.