# Which test to use to compare calculated percentages?

I have data in the following form:

subject PercA PercB PercC PercD
A1    0.12  0.33  0.40  0.15
A2    0.14  0.31  0.38  0.17
...
B1    0.18  0.30  0.35  0.17
B2    0.17  0.29  0.39  0.15
...


The percentages in each row sum up to 1 because the percentages are calculated like this: PercA=A/(A+B+C+D), PercB=B/(A+B+C+D) and so on.
So, now I want to test whether this percentage "profiles" differ between subjects from group A and B. What kind of statistical test is applicable for this scenario?

• I think &chi;<sup>2</sup> can do the trick. Best regards. – Michael Hooreman Apr 15 '15 at 11:56
• Do you have raw numbers available? – rnso Apr 15 '15 at 11:56
• Yes, they're available but I'm interested if there's a difference between the percentage profiles and not between the raw numbers. – Alex Apr 15 '15 at 11:59
• Using raw numbers will take care of that aspect and IMHO will be better. – rnso Apr 15 '15 at 12:03
• I could be that the raw values are generally higher in one group. Then there would be a difference between the groups but the percentage distribution could even be the same. Therefore the raw values can not answer the question I'm asking for. – Alex Apr 15 '15 at 12:15

You can possibly rearrange the data and use regression like this:

> mydf
subject num PercA PercB PercC PercD
A 1 0.12 0.33 0.40 0.15
A 2 0.14 0.31 0.38 0.17
B 1 0.18 0.30 0.35 0.17
B 2 0.17 0.29 0.39 0.15

> mm = melt(mydf, id=c('subject','num'))
> mm
subject num variable value
1        A   1    PercA  0.12
2        A   2    PercA  0.14
3        B   1    PercA  0.18
4        B   2    PercA  0.17
5        A   1    PercB  0.33
6        A   2    PercB  0.31
7        B   1    PercB  0.30
8        B   2    PercB  0.29
9        A   1    PercC  0.40
10       A   2    PercC  0.38
11       B   1    PercC  0.35
12       B   2    PercC  0.39
13       A   1    PercD  0.15
14       A   2    PercD  0.17
15       B   1    PercD  0.17
16       B   2    PercD  0.15

> summary(lm(value~subject+variable, data=mm))

Call:
lm(formula = value ~ subject + variable, data = mm)

Residuals:
Min       1Q   Median       3Q      Max
-0.03250 -0.01063  0.00125  0.01188  0.02750

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)    1.525e-01  1.186e-02   12.86 5.69e-08 ***
subjectB      -2.631e-17  1.061e-02    0.00    1.000
variablePercB  1.550e-01  1.500e-02   10.33 5.32e-07 ***
variablePercC  2.275e-01  1.500e-02   15.17 1.01e-08 ***
variablePercD  7.500e-03  1.500e-02    0.50    0.627
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.02121 on 11 degrees of freedom
Multiple R-squared:  0.9683,    Adjusted R-squared:  0.9568
F-statistic: 84.03 on 4 and 11 DF,  p-value: 3.599e-08

• rnso sorry, for some reason the scroll bars weren't showing on my screen. As soon as I realized there was more I deleted my comment. However, least squares regression is generally unsuited to proportion data for a number of reasons. You might consider logistic regression if the original counts are available. – Glen_b -Reinstate Monica Apr 15 '15 at 12:38
• The OP does'nt want to use original counts (please see comments below the question). – rnso Apr 15 '15 at 12:47
• I see now the OP is saying he doesn't have count data, in spite of previously saying he had the original counts. There's still a potential variance problem with OLS with continuous proportions, but there are several ways it might be dealt with. – Glen_b -Reinstate Monica Apr 15 '15 at 15:08

Firstly, You've to assume that percentage "profiles" in the same group are hypothetically same or you can test with the use of ANOVA.

after getting same individual groups are hypothetically same.

Then, take population average of Group A and Group B

Then, apply F-test to see whether percentage "profiles" came from same population and assume that percentages are Normally distributed(Note:- score percentages usually are Normal)

Then you can test whether this percentage "profiles" differ between subjects from group A and B from t-test.

OR if you want to check whether a student perform in a same way in both subject group A&B, then you can use Chi-Squared contingency table.

Note:-as from your comment "raw values are generally higher in one group" so you can't use ANOVA for group A and group B together.

Regards,