Then he suggested to drop term number seven. I have doubt why dropping term number 7 the final two terms represent the average log-fold change for male mice over female, in the LFD or WD-fed mice. The design matrix would be:

SDM.LFD

SDM.WD

Filename

Sexe

Diet

0

0

sample13

F

LFD

0

0

sample14

F

LFD

0

0

sample15

F

LFD

0

0

sample16

F

LFD

0

0

sample17

F

LFD

0

0

sample18

F

LFD

0

0

sample19

F

WD

0

0

sample20

F

WD

0

0

sample21

F

WD

0

0

sample22

F

WD

0

0

sample23

F

WD

0

0

sample24

F

WD

1

0

sample1

M

LFD

1

0

sample2

M

LFD

1

0

sample3

M

LFD

1

0

sample4

M

LFD

1

0

sample5

M

LFD

1

0

sample6

M

LFD

0

1

sample7

M

WD

0

1

sample8

M

WD

0

1

sample9

M

WD

0

1

sample10

M

WD

0

1

sample11

M

WD

0

1

sample12

M

WD

Do the last two terms represent SDM.LFD-SDF.LFD and SDM.WD-SDF.LFD? Am I wrong?

Dropping the 7th term in design2 is necessary to achieve full column rank, otherwise there is no unique least-squares solution to the system of linear equations. Once dropped, the last two coefficients represent the male/female log-fold change in each diet. There is no "SDF.LFD" term in the final matrix, so I don't know what you're referring to there.

thank you for your comment. "SDF.LFD" term seems to be the reference level for factor SD and if you do not drop the coefficient 7 (you need to achieve full column rank), the three terms "SDM.LFD", "SDM.WD" and "SDF.WD" (the once dropped) should represent the log-fold change respect the reference level (SDF.LFD), am I right? What is not clear to me is why once dropped, the last two coefficients (SDM.LFD and SDM.WD) represent the male/female log-fold change in each diet?

Because the SD levels are nested within Litter. Once you drop the 7th term, the reference level in the WD litters becomes "SDF.WD". You can convince yourself of this by looking at the design matrix. For example, let's look at sample 24. In the linear model described by design2 (after dropping coefficient 7), sample 24 has the terms:

You can see that sample 24's expression is equal to the sum of the intercept and LitterL48. This means that sample 24's group (i.e., "SDF.WD") is the baseline for all litter 48 samples. By comparison, if we look at sample 10, we get:

... which demonstrates that SDM.WD represents the difference in (log-)expression between sample 10's group (i.e., "SDM.WD") and sample 24's group, i.e., the log-fold change between male and female mice in the WD group.