I am wondering what regression model or otherwise I could use to determine the predictors of school performance using examination results data that is structured as below. The variables are: school code which is unique, the geographical region a school is in; school founder; annual school expenditure per pupil; pupil-teacher ratio (PTR); and the aggregated number of students (by gender) that attained grades A, A-, B+, B, B- and so on.

The actual dataset has many other variables that I could use as independent variables (both continuous and discrete) that I have not included in this question. The variable I would like to use as my dependent variable(s) have already been aggregated (i.e. number of students by grade and sex as shown in the table), which is where my challenge lies. How can I analyze the data without manipulating it too much that I end up losing some data? There are over 10,000 schools in the dataset.

Sch code region founder $/pupil PTR Boys A Boys A- Boys B+ Boys B Boys B- Girls A Girls A- Girls B+ Girls B Girls B-
1 Southern Church 2,300 23 5 15 36 27 19 4 19 36 22 22
2 Central Private 2,560 19 8 10 46 17 9 7 12 30 10 12
3 Northern Govt 1,390 35 3 12 22 26 10 0 25 36 20 32

2 Answers 2


You may like to convert each letter grade into a new numeric variable "grade". So A is encoded as 95, A- as 85 or whatever the mean of the range that the grade corresponds to is. Then your data will have columns: Region, Founder, $/pupil, PTR, Grade, Gender, Frequency

Sch code region founder $/pupil PTR Gender Grade Frequency
1 Southern Church 2,300 23 M 95 5
1 Southern Church 2,300 23 M 85 15
1 Southern Church 2,300 23 M 75 36


If you leave the response variable as a categorical variable you will need more advanced methods to model it. Not to say it can't be done! But I would recommend the above encoding.

Sch code region founder $/pupil PTR Gender Grade Frequency
1 Southern Church 2,300 23 M A 5
1 Southern Church 2,300 23 M A- 15
1 Southern Church 2,300 23 M B 36

Then the world is your oyster, standard regression methods can be applied.

  • $\begingroup$ I tried to add a comment to your answer but it turned out to be too long. So I put it as an answer. $\endgroup$
    – Oscar
    Commented Apr 12, 2021 at 16:52

@Cameron Chandler thanks a lot for your answer. My concern with converting the letter grade into a new numeric variable "grade" is that I might end losing some info. I am leaning more towards the second suggestion of having the response variable as an ordinal variable and using a regression technique that is most appropriate. I am thinking of breaking down the frequency column in your second table into individual rows so that each row represents a student. See below:

Sch code student # ... ... Gender Grade
1 1 ... ... M A
1 2 ... ... M A
1 3 ... ... M A
1 4 ... ... M A
1 5 ... ... M A
1 6 ... ... F A
1 7 ... ... F A
1 8 ... ... F A
1 9 ... ... F A

Given that most of the explanatory vars are describing the school, there will be a lot of repetition of data, the only var that will be changing for students within the same school will be gender. Hence am thinking of using a clustered model, specifically mixed-effect modeling, with the var school code as the random effect. Will this approach be better than your first suggestion of creating a new numeric var as the response var?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.