So you can see that they're not exactly the same,

but they're very highly correlated with each other,

and you can see for example that

the moderated t-statistic has

a different distribution than the regular t statistic.

So then I can add

a color to that or aligned to that, a 45 degree line.

You see they're very similar.

Basically, mostly during the edges

are different from each other.

A key thing to note here

is that I had to multiply by

a minus here in front of the t-stats,

and that's because basically, we don't know,

there's not a natural direction

for this t-statistic to go.

You have to make sure that the effects

are going in the same direction.

So you can't do

an adjusted statistic using the gene filter package,

but you can using the limma package.

So here I create

a model matrix that has the string variable,

it also has the lane number variable as well.

So then I can just fit that

using the lmFit command just like I did before,

but with the adjusted model matrix.

Then I can calculate the shrinkage estimates.

Now I get t-statistics that are shrunk for the intercept,

the strain, as well as the all the different levels

of this late lane variable.

So now I'm going to get very different results.

So if I plot here the results that I get out from

the adjusted model versus

the t-stats that I got from gene filter,

they'll be very different because I'm no longer in

one case I'm actually doing an adjustment,

and in one case I'm not doing an adjustment.

So here you get

different statistics all the way through

including in the middle of the distribution.

So I can add

the 45 degree line and you see that

there's still highly correlated with each other,

but they're no longer the exact same.

In fact, you see a little bit off the 45 degree,

the coefficients from the adjusted statistic.

Okay. So another option that you can do is you can

actually fit factor model

for multiple level factor using limma.

So here I'm going to create the model matrix for that,

where I have the lane number factor level,

and then I can fit the model just like I did before,

where I'm just passing it the new model matrix

for lane and the expression data.

Then I can do the same empirical Bayes estimation

of the statistics.

So now you can see I have

statistics just for the lane variable.

So suppose I wanted to do a comparison of,

is there any difference between any

of these lanes whatsoever,

I can use the top table function to do that.

So if I want to find

the top statistically associated genes with the lane,

I can pass it moderated fit

from the limma analysis for lane,

and I can tell which coefficients I want to look

at to calculate the statistic for.

So in this case,

I see that it's the second coefficient

starts the lane and

the last one is the seventh coefficient.

So then I say, how many do you want me to report?

So it's a top table so it'll report then

the n most statistically associated genes.

In this case, I want to see all of them.

So I'm going to say, report every single gene.

Then I don't want it to be sorted so

that it's in the same order as the gene that I have.

So I have this top lane variable

which gives me the F-statistic, the p value,

and the adjusted p value for

these calculation where you're looking

at the association with

any of the levels of the lane variable.

So I can plot that versus the F-stat

from calculating the same thing

with the gene filter package,

and it's going to be a little bit different here because

again we're doing a moderation of the statistics,

so it's not quite the same thing.

I can do the same thing in edge,

and again this might be a way or work

if you don't have as much knowledge and model matrices.

So you can again build this study

using the expression data,

you can tell what group variable you want to do here.

I'm going to say, use the lane number

as the group variable,

and then you can calculate the differential expression

using the LRT command

that stands for likelihood ratio tests.

So once I've done that,

I can actually also calculate

the Q values that go with that,

but one of the components of that Q value

is the stat variable.

So I can use that stat variable to

calculate a comparison with

the F-stats from the gene filter package.

So in this case, they're exactly

the same because there's no moderation.

So the statistics you get from gene filter and

the statistics you get from edge are exactly the same,

but with edge you can do an adjustment variable.

So here I'm going to again build the same study.

I'm going to use a build study,

I'm going to pass it the gene expression.

I'm going to tell it the group is the lame number,

but here I want to adjust for a strain.

So I'm passing it an adjust variable with adj.var.

So now I have this second edge object.

I'm going to be the second differential

expression object,

calculate this second set of key values.

So now the F-stats might be

different because I've adjusted for variables

and now you see that the F-stats are same

once you adjust for the strain.

So those are three different ways that you can calculate

statistics for many regression models in R.