Question: Hello there, hope all of you are fine. I do hope you are enjoying this weekend.
In my little experience, I always had to deal with samples coming from different batches (i.e. coming from different hospitals or experiments done in different days). One postdoc in my lab showed me how to deal with batch effect by using **SVA package.** I guess it is a brilliant idea to work with that, but if I don't go wrong this is not the best tool to cope with the batch effect as, in my cases, I may know the source of confounding (in other words, I know that samples are generated in different days/ come from different hospitals).

**My first question is**: at first glance, by looking at the PCA plot from this experiment, how can you determine (i.e. be absolutely sure) that your samples are biased or not. How can you be absolutely sure that your samples need a correction, if they cluster as expected? and if they don't cluster as you would expect how can you know that this is not due to **real** biology or not? what if you are **over-correcting** samples and removing relevant biological data that, in turn, make impossible to determine **genes that are *truly* changing**? how can you know that?

**My second question is** more practical and, basically, linked to my inexperience. Given the fact I have always used this SVA package by slavishly following postdoc recommendation (with her own doubts), I would like to deal with this problem in a definite way; hopefully, by designing a model matrix. I have zero ideas on where to start and if you could help me with some advice, that would be grand! I really need your help guys, cause I am absolutely alone now and don't know who to ask.
I have found this [link][1] but it seems to be a bit advanced for myself.

[1]: http://genomicsclass.github.io/book/pages/adjusting_with_linar_models.html

Answer: > At first glance, by looking at the PCA plot from this experiment, how
> can you determine (i.e. be absolutely sure) that your samples are
> biased or not:

I think it is safe to assume that there is always some technical bias in an experiment. So rather than determining whether your samples are biased or not, **a PCA allows qualitatively assess how big is this technical bias (batch effect) compared to the other factorial effects**. Note that you need at least two samples from the same batch to see if your samples group by batch in the principal component space.

> How can you be absolutely sure that your samples need a correction, if
> they cluster as expected? and if they don't cluster as you would
> expect how can you know that this is not due to real biology or not?

To interpret the PCA, always think in term of variability. The samples will always cluster depending on the major source of variability. Usually there would be at least three sources of variability: the controlled biological factors (for instance, healthy vs diseased sample), the batch effect (day, hospital), and the residual biological/technical variability:

- If the samples cluster based on the controlled biological factors, that means that it is the main source of variability. In consequence, you are likely to find biological effects. I would still correct for batch effect though, because being a minor source of variability doesn't mean that there is no batch effect at all.
- If the samples primarily cluster based on batch, it could mean that the variability caused by batch is very high or that the variability caused by the controlled biological factors is low. Either way, you'll need to correct for batch.
- Finally, if sample are clustered seemingly randomly, it means that the residual biological/technical variability is the main source of variability. It is the worse case scenario because you can not really control for this kind of residual effect. Usually, it means that you will need a highly powered study in order to extract relevant biological information from that "mess".

> I would like to deal with this problem in a definite way; hopefully,
> by designing a model matrix

The idea of linear model, which is a great way to take care of batch effects, is also linked to the sources of variability. The link you provided is a good start, but I'll try to make the basics clearer. In a linear model, you will express a measure, for instance gene expression, by the sum of modeled effects of biological/batch factors you know of:

gene expression ~ factor_1 + factor_2 + factor_1:factor_2 + batch
("~" means that what is on the left is explained by the formula on the right ; ":" means that you choose to also model the interaction factor_1 and factor_2)

The formula above is dependent of a design matrix that specify the levels of the factors for each sample. for instance:

factor_1 factor_2 batch
sample1 A X I
sample2 A Y II
sample3 A Y I
sample4 B X I
sample5 B Y I
sample6 B Y II

Hope this helps,

Carlo