Dear list,
I am calculating the 95th percentile of a set of values with R and with SPSS
In R:
> normal200<-rnorm(200,0,1)
> qnorm(0.95,mean=mean(normal200),sd=sd(normal200),lower.tail =TRUE)
[1] 1.84191
In SPSS, if I use the same 200 values and select Analyze -> Descriptive
Statistics -> Frequencies
and under "Statistics", I type in '95' under Percentiles, then the output is
Percentile 95 1.9720
I think the main difference is that SPSS only calculates critical values within
the range of values in the data, while R fits a normal and calculates the
critical value using the fitted distribution. This is more obvious if the size
of the data is much lower:
> normal20
[1] 0.27549020 0.87994304 -0.23737370 0.04565484 -1.10207183 -0.68035949
0.01698773 -2.15812038 0.26296513 0.21873981 0.03266598 -0.01318572
[13] 0.83492830 0.54652613 0.73993948 -0.31937556 -0.03060194 -0.96028421
0.27745331 -1.01292410
> max(normal20)
[1] 0.879943
> qnorm(0.95,mean=mean(normal20),sd=sd(normal20),lower.tail =TRUE)
[1] 1.118065
And in SPSS
Percentile 95 0.8777
Can anyone comment on my statement? and thus, is R more exact? The differences
are quite large and this is important for setting thresholds.
Cheers,
Dave
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.