# How to perform OLS when available independent variables differ between data points?

I would like to investigate the relationship between high school grades for different subjects and university credits earned in the first year. I plan to use multiple linear regression (OLS). I have data on the average grades of students in several subjects (that is, the average grade per subject, per student) and the credits earned by those students in their first year of university.

The problem however is that by far most students do not follow all subjects. For example, some follow history, some don't, some follow math 1, some follow math 2, some follow both. This means I can't construct a matrix $X$ that contains all average grades per subject per student, to perform the regression with, because I would have 'missing' values in almost all rows.

How should I deal with this?

Deleting all students that don't follow all subjects would leave me with very few data points and is probably not very representative of the general population of students.

Googling has led me to data imputation, would that be a good idea here? If so, how can I do this and what method should I apply?

• What does it mean to "follow" a subject? To write a course in high school then write it again (or a similar course) in college? – AdamO Jan 10 '18 at 14:49
• @AdamO: Following a subject is only about high school, I'm not actually interested in the grades or specific courses in university. – Dasherman Jan 10 '18 at 22:07
• I think you've missed my question. You need to define your terminology to obtain useful answers. We don't know in what sense people have been "followed" – AdamO Jan 10 '18 at 22:46
• I think "follow" means "take". – Peter Flom Jan 11 '18 at 12:31