How does the size of a dataset affect confounding in both randomised trials and observational studies? I have heard that larger sample sizes in randomised trials lead to a smaller possibility of confounding. 


*

*Why is this true in the case of randomised trials?

*Also, how does sample size of an observational study affect confounding?

 A: First, a note: Randomized trials are not immune to confounding and other types of bias, though the randomization process helps protect them against it. Systematic flaws in the trial however, are just as serious as they are in observational studies.
The answer to your question lies in how randomization works, and why we're doing it. The idea is to balance the two (or more) arms of the trial so that they represent nearly identical populations. In order for something to be a confounding variable, if must be associated with the exposure, and randomization destroys any association that exists.
However in order to do that, the arms of the trial must be balanced, or at least close to it. As randomization is (as the name suggests) a random process, this might not necessarily be true. It is possible that all patients with a confounding variable X could end up in the control arm, while all of those without X might end up in the treatment arm. This circumstance, where randomization fails to balance the arms, is more likely in smaller populations. For example, its possible in a trial of four people (2 men and 2 women) that both men would end up in the placebo arm, and both women in the control arm - potentially introducing confounding. In a trial of 10,000 people (5,000 men and 5,000 women), that is exceedingly unlikely.
For observational studies, study size has a less clear impact on confounding. You can't simply add people to a cohort study, for example, and expect confounding not to be a problem. However, a larger study has greater power, and can afford to "spend" some of its precision on more advanced and sophisticated techniques for control for confounding. For example, if I have a study of 100 people, there are only so many covariates I can include in the model, and I might be hesitant to use second or third-order terms for some of those covariates, because it will start to erode the precision of my final estimate. With a study of 100,000 people, you can go to town, and start using far more sophisticated methods of controlling for confounding without really harming the qualitative precision of your estimate - in the case of clinical trials or observational epi, whether your effect measure's 95% CI ends up crossing null.
