I have at my disposal the following database
dataset <-data.table(CORRECT=c(52,78,18,27,40,85,59,90),
TOTAL=c(60,96,26,35,45,85,65,96),
RANDOMIZATION=factor(c("Control","Test")),
CASE=factor(c(1,1,2,2,3,3,4,4)))
dataset[, PROP := CORRECT/TOTAL]
I would like to make a comparison test of two proportions (p.value) for each CASE (1,2,3,4) according to RANDOMIZATION (Control, Test) in order to obtain the following table:
CORRECT | TOTAL | RANDOMIZATION | CASE | PROP | PVALUE |
---|---|---|---|---|---|
52 | 60 | Control | 1 | 0.86 | x.xx |
78 | 96 | Test | 1 | 0.81 | |
18 | 26 | Control | 2 | 0.69 | x.xx |
27 | 35 | Test | 2 | 0.77 | |
40 | 45 | Control | 3 | 0.89 | x.xx |
85 | 85 | Test | 3 | 1.00 | |
59 | 65 | Control | 4 | 0.91 | x.xx |
90 | 96 | Test | 4 | 0.94 |
The idea is then to obtain the following graphical representation :
Aucun commentaire:
Enregistrer un commentaire