Analysis of institutional data for physics majors showing predictive relationships between required mathematics and physics courses in various years is important for contemplating how the courses build on each other and whether there is need to make changes to the curriculum for the majors to strengthen these relationships. We used 15 years of institutional data at a US-based large research university to investigate how introductory physics and mathematics courses predict male and female physics majors’ performance on required advanced physics and mathematics courses. We used structure equation modeling (SEM) to investigate these predictive relationships and find that among introductory and advanced physics and mathematics courses, there are gender differences in performance in favor of male students only in the introductory physics courses after controlling for high school GPA. We found that a measurement invariance fully holds in a multi-group SEM by gender, so it was possible to carry out analysis with gender mediated by introductory physics and high school GPA. Moreover, we find that these introductory physics courses that have gender differences do not predict performance in advanced physics courses. In other words, students could be using invalid data about their introductory physics performance to make their decision about whether physics is the right field for them to pursue, and those invalid data in introductory physics favor male students. Also, introductory mathematics courses predict performance in advanced mathematics courses which in turn predict performance in advanced physics courses. Furthermore, apart from the introductory physics courses that do not predict performance in future physics courses, there is a strong predictive relationship between the sophomore, junior and senior level physics courses.