Under the assumed causal graph, we found that compared to online learning, face-to-face learning improved student performance in the end-semester examination in undergraduate students, but worsened student performance in postgraduate students. These findings suggest that different modes of learning may suit different types of students. Importantly, this is the first attempt to estimate causal effects of the mode of learning on student performance under a causal structure. This approach makes our assumptions transparent, informs data analysis, and is recommended when using observational data to make causal inferences.