We report results from two studies testing the Mediation Model of Research Experiences (MMRE), which posits that science (or engineering) self-efficacy and identity as a scientist (or engineer) mediate the association between support programs and students' commitment to science, technology, engineering, and mathematics (STEM) careers. Study 1 included 502 matriculated and recently graduated undergraduate STEM students. Structural equation modeling analyses indicated that research experience, instrumental mentoring, and involvement in a community of scientists were associated with commitment to a STEM career, mediated through science/engineering self-efficacy and identity as a scientist/engineer. There were few interactions with ethnicity and none with gender. In Study 2, 63 undergraduate students in science/engineering support programs were surveyed with a similar instrument at the beginning and end of their programs. Pre-post analyses indicated that increases over time in community involvement were associated with increases in science/engineering self-efficacy, and increases over time in science/engineering identity were associated with increased commitment to a STEM career. Taken together, these two studies show the importance of psychological processes such as identity and self-efficacy in understanding the specific ways in which science/engineering support programs lead to enhanced commitment to a career in STEM among white and underrepresented minority undergraduate students.