I'd be too happy, if someone could post a code snippet, which explains how to compute mean and variance of a set of records, which contain frequencies?
Suppose we have records like (FORMAT F)
- GroupA, 6 x Grade 1, 5 x Grade 2, 10 x Grade 3
- GroupB, 2 x Grade 1, 7 x Grade 2, 18 x Grade 3
- GroupA, 23 x Grade 1, 5 x Grade 2, 1 x Grade 3
- GroupA, 10 x Grade 1, 15 x Grade 2, 12 x Grade 3
Goal: Compute for each Group's mean and variance of grades using SPSS syntax.
Clarification:
Using SPS, processing cases (FORMAT C) would be simple (as colleagues told me):
# Record number 1 (line 1 of the above data)
GroupA, Grade 1
... 6 times
GroupA, Grade 1
GroupA, Grade 2
... 5 times
GroupA, Grade 2
GroupA, Grade 3
... 10 times
GroupA, Grade 3
# Record number 2 (line 2 of the above data)
GroupB, Grade 1
GroupB, Grade 1
GroupB, Grade 2
... 78 times
GroupB, Grade 7
... and so on
Unfortunately, we don't have cases of FORMAT C, but already aggregated data as in FORMAT F.
I probably should atadd this:
I implemented a solution, which uses (user entered) FORMAT F data using PHP/SQL: The PHP program constructs an SQL query, which computes the mean, the variance and the standard deviation of each Group.
I even tested the solution using well-known sample data. The results are identical. Thus I'm sure the solution is correct.
Since the computed statistical properties are sensible, I'd like to get a verification using a standard statistical package using the real FORMAT F data (not the test case data).
My colleague is going to use SPSS.