Size: 838
Comment:
|
Size: 913
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 22: | Line 22: |
cc <- rep(-99,length(score)) | |
Line 23: | Line 24: |
kct <- 0 | |
Line 27: | Line 29: |
if (b[i] == FALSE) { | a[i] <- score[i] kct <- kct+1 if (b[i] == TRUE) { |
Line 29: | Line 33: |
a[ict] <- score[ict] | a[ict] <- score[kct] |
Line 34: | Line 38: |
cc |
How do I find out how many people have a score above a certain value?
Percentiles give the percentage of people who have a score below a threshold score.
Percentile (score) = 100 $$\frac{\mbox{n} \leq \mbox{score}}{\mbox{N}}$$
100 - Percentile (score) = 100 $$\frac{\mbox{n} \gt \mbox{score}}{\mbox{N}}$$
The percentiles for each score are routinely outputted using the frequency procedure in SPSS.
FREQUENCIES VAR=SCORE. EXE.
In R the percentages of people with scores equal or below each observed score can be obtained by running
perc <- rep(-99,length(score)) a <- rep(-99,length(score)) cc <- rep(-99,length(score)) ict <- 0 kct <- 0 b <- duplicated(score) ict <- ict+1 for (i in score) { perc[i] <- 100*sum(score<=i)/length(score) a[i] <- score[i] kct <- kct+1 if (b[i] == TRUE) { ict <- ict+1 a[ict] <- score[kct] } } perc a cc