Diff for "FAQ/perc" - CBU statistics Wiki
location: Diff for "FAQ/perc"
Differences between revisions 13 and 14
Revision 13 as of 2008-04-11 11:57:21
Size: 913
Editor: PeterWatson
Comment:
Revision 14 as of 2008-04-11 12:01:17
Size: 822
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
cc <- rep(-99,length(score))
ict <- 0
kct <- 0
ict <- 1
Line 26: Line 24:
ict <- ict+1
Line 29: Line 26:
a[i] <- score[i]
kct <- kct+1
if (b[i] == TRUE) {
Line 33: Line 27:
a[ict] <- score[kct] if (b[i] == FALSE) {
a[i] <- score[ict]
Line 38: Line 33:
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))
ict <- 1
b <- duplicated(score)
for (i in score) {
perc[i] <- 100*sum(score<=i)/length(score)
ict <- ict+1
if (b[i] == FALSE) {
a[i] <- score[ict]
 }
 }
perc
a

None: FAQ/perc (last edited 2013-03-08 10:17:13 by localhost)