Re: Percentiles
"John Darrington" <[email protected]> Sat, 27 Mar 2004 12:05:55 +0800
| Newsgroups | gmane.comp.gnu.fiasco.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============0392196556==
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH"
Content-Disposition: inline
--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Fri, Mar 26, 2004 at 10:57:02AM -0400, Michael Kiefte wrote:
At least my definition is consistent with SPSS. =20
I'm not convinced !!!
I don't have a copy of SPSS, but I have a tutorial book, which uses
the following example data set:
75.00 ,
66.00 ,
47.00 ,
80.00 ,
72.00 ,
51.00 ,
43.00 ,
60.00 ,
75.00 ,
70.00 ,
30.00 ,
68.00 ,
80.00 ,
56.00 ,
77.00 ,
64.00 ,
74.00 ,
76.00 ,
45.00=20
I ran this through your algorithm and got the 25th percentile: 53.50
In my book however, the sample SPSS printout gives 51.00 which is what
you'd get if you used the more naive algorithm:
double=20
pctile(double *x, size_t n, double q)
{
/* make sure q is between 0.0 and 1.0 inclusive */
double idx =3D (n-1)*q;
int lo =3D (int) idx;
qsort(x, n, sizeof(double), cmp);
return x[lo];
} =20
The book says it's based on SPSS Version 11.0=20
If anyone's got a copy of SPSS would they care to try this:=20
DATA LIST LIST /SALES * .
BEGIN DATA.
75.00=20
66.00=20
47.00=20
80.00=20
72.00=20
99.00=20
51.00=20
43.00=20
60.00=20
75.00=20
70.00=20
30.00=20
68.00=20
80.00=20
56.00=20
77.00=20
64.00=20
74.00=20
76.00=20
45.00=20
END DATA.
MISSING VALUE sales (99.0) .
FREQUENCIES
VARIABLES=3Dsales
/PERCENTILES =3D 25 50 75.
FINISH.
--=20
PGP Public key ID: 1024D/2DE827B3=20
fingerprint =3D 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://wwwkeys.pgp.net or any PGP keyserver for public key.
--7JfCtLOvnd9MIVvH
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFAZP2jimdxnC3oJ7MRAhzwAJ98LJXtWHTP8SlCiafHHFJvjEiAFACdEopq
QZ5Qds1g9ed8ZgrJxo+dkT8=
=73in
-----END PGP SIGNATURE-----
--7JfCtLOvnd9MIVvH--
--===============0392196556==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
pspp-dev mailing list
[email protected]
http://mail.gnu.org/mailman/listinfo/pspp-dev
--===============0392196556==--