Recent concern about the underrepresentation of women and racial minorities in computer science (CS) has initiated measures to increase their participation in the field. Unfortunately, these groups remain underrepresented in the undergraduate level of CS. To improve this situation and specifically at the University of Rhode Island, we conducted a study to investigate the attrition rate of underrepresented students who switched to other majors compared to the majority of students. We collected background, demographic, and performance data of all of our students in the first four CS classes for the past four years. We used logistic regression to show any significant effect of gender and/or race on the attrition rate. We also used the Synthetic Minority Oversampling Technique (SMOTE) for oversampling to make up for the small sample of underrepresented students in the major. As a result, we find that underrepresented students are at a higher risk of leaving CS. Another finding of this research is that female students who left CS outperformed male students under the same circumstances, which implies that academic progress is not the main reason that women are changing their majors. Conversely, underrepresented minorities had low grades' averages when they change their majors, which implies that they likely leave CS due to academic struggles.