# How do I use cumulative distribution functions to compute p-values in SPSS, EXCEL and R?

P-values may be computed for an observed sample statistics, x, using the *cumulative distribution function* (CDF) of a particular distribution.

For x < 0 (1-sided) p-value = CDF(x) = P(X <= x) For x > 0 (1-sided) p-value = 1- CDF(x) = P(X >= x)

A list of CDFs for various distributions is available in SPSS by clicking transform>compute and choosing CDF and noncentral CDFs.

In EXCEL the normdist(x,mean,standard_dev,cumulative) function will give P(X < -x) + P(X > x) for a z-score, x, coming from a Normal distirbution with given mean and s.d. Placing "False" as the cumulative gives a two-tailed p-value. For example typing in a spreadsheet cell

=normdist(1.96,0,1,FALSE)

and pressing the enter button gives a (two-tailed) p of 0.05.

In R information on the implementation of commonly used cdfs can be obtained by typing at the R prompt help(dt) for the t distribution, help(dnorm) for the Normal distribution, help(dchisq) for the chi-square distribution and help df for the F distribution.

There also tables (Neave, 1978;1981) which can be photocopied for manual use onto an A4 sheet for specified distributions. The 1981 tables should be in the CBSU library. Howell, (2002) also has tables giving test statistics at certain specific p-values for a variety of well used distributions. The gaps (to obtain points in the distribution relating to other p-values) in these tables could be estimated using linear interpolation.

* Programs to obtain p-values using EXCEL and SPSS are available here.