In this paper, we build a new test of rational expectations based on the marginal distributions of realizations and subjective beliefs. This test is widely applicable, including in the common situation where realizations and beliefs are observed in two different datasets that cannot be matched. We show that whether one can rationalize rational expectations is equivalent to the distribution of realizations being a mean-preserving spread of the distribution of beliefs. The null hypothesis can then be rewritten as a system of many moment inequality and equality constraints, for which tests have been recently developed in the literature. Next, we go beyond testing by defining the minimal deviations from rational expectations that can be rationalized by the data in the context of structural models. Building on this concept, we propose an easy-to-implement sensitivity analysis on the assumed form of expectations. Finally, we apply our framework to test for rational expectations about future earnings, and examine the consequences of such departures in the context of a life-cycle model of consumption. participants of various seminars and conferences for useful comments and suggestions. † CREST, xavier.dhaultfoeuille@ensae.fr. ‡ CREST and TSE, christophe.gaillac@tse-fr.eu.