Can a percentage be used to calculate the mean etc. in a t-test? I have data that includes the number of students in a class and the percentage of that group who achieved a preset pass level in a standard test. I have this data for a number if different schools in two population samples, about 30 schools in each. The class sizes differ considerably, so it seems take sense to use the percentage already given when calculating the t-test.
But I also know that percentages shouldn't be averaged. I could calculate the number of students from the data given, but this does not reflect class size, which seems important. The percentage "automatically" reflects the weighting of class size. Any advice or thoughts about  this problem appreciated.
Example data to illustrate problem
No students    percent passed     calculated no passed

28                7%                2

79                7%                6

28               51%               14

58               50%               29

Thanks
Tim
 A: There are several issues here.
Q1. Can a t-test be used with data that is a percentage?
A - Strictly speaking a t-test should be used when the underlying population has a normal distribution and you have to estimate the mean and variance simultaneously.  Your percentage pass rates are not going to normally distributed, but they may well be close enough that no harm is done by using a t-test.  This is unlikely to be the big obstacle.
Q2. What is the right way to aggregate the percentage pass rates into an overall pass rate?
A - you should use a weighted average of the percentages, with the weights being the class sizes.  This will give you a percentage (for each of your two groups of classes) that is equivalent to their overall individual percentage pass rate.  There are several equivalent ways of calculating this; one is by a weighted average, the other is (as you have started doing) converting each class score into a number of passing students and a total number of students, summing these numbers and calculating the final percentage.
There are complications in estimating the variance to use for a t-test but I will ignore these because of Q3 below:
Q3. (implied) - is this procedure as a method of comparing pass rates between two groups appropriate?
A - No. The problem is that there are known to be very significant class (teacher) and school effects in educational performance.  No simple t-test can take these into account, and a t-test will give you a big chance of showing something as significant when it isn't.  Basically, the data in these grouped situations is not worth as much as its sample size suggests.  This is because 30 students in one class are not really 30 independent data points - they may all be reflecting skill of the teacher (even putting aside other important known environmental variables, and their individual socio economic background).  The accepted way to do the sort of inference you want is with a multi-level model, a special case of a mixed-effects model, which unfortunately is much harder to implement than a t test, but will give you much more reliable results.
