You left out the most important factor in educational attainment which is parental/family attitude toward education.
Race, location, culture, socioeconomic status, single parent situation, medial issues, etc are all significant factors but without question the most important factor of educational attainment is the parental attitude regarding education. If the parents value it, kids tend to value it. If they don't care, kids won't either. If its meh, then you get the in-between kids where engaging teaching or poor teaching really shows its value/detriment.
Like anything else its not absolute but its pretty amazing watching the correlation.