| Date: | Fri, 26 May 2000 16:06:42 -0700 |
| Reply-To: | Cassell.David@EPAMAIL.EPA.GOV |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "David L. Cassell" <Cassell.David@EPAMAIL.EPA.GOV> |
| Subject: | Re: Proc Univariate Output |
|
| Content-type: | text/plain; charset=us-ascii |
|---|
Pat, you wrote [in part]:
> to zero. However, the values returned by SAS do not match those obtained
> from binomial tables and excel, so it must be something else.
First of all, never trust stat results from Excel. If a stat
package and Excel disagree about a stat result, trust the stat
package. NOT MS Excel. Please. I think there's a recent paper
in Journal of the ACM about the flaws in Excel results on test
datasets.
> For example, with N=175 observations and M(Sign)=4.5 (implying 92
> "sucesses" out of 175 if values greater than zero are defined as
> sucesses), SAS returns a Pr>=[M] of .5455. The p-value for the two
> tailed sign test should be about .2249. It would be nice to have SAS
Funny, but I don't get .2249 either. I assume you normalized, and
looked the value up in the normal tables [although you didn't say so].
A few problems: [1] the normal approximation is just that - an
approximation {a tiny error}; [2] it looks like you failed to use the
typical 1/2 continuity correction {still a small error}; and you forgot
to multiply the tail probability by 2 in order to compute the 2-tailed
p-value.
> automatically calculate the sign test for me. We have SAS version 6.12.
I got the same answer as SAS version 6.12 . Here's what I did.
P{S > |M|} = 2 * sum{j=0 to min(p,n-p)} nCj * 0.5**n
where n = number of non-zero values
p = number of values greater than 0
nCj = binomial coefficient
You have to truncate the sum at min(p,n-p) in order to get the right
2-tailed test, and you need to remember to multiply by 2 afterward.
Now either compute this directly [icky for n=175], or use the binomial
approximation with continuity correction:
2 * Phi( (83+0.5 - 175*0.5)/sqrt(175*0.5*0.5) )
= 2 * Phi ( -.6047 )
which is about .546 .
Mathematica can do this much cleaner than I can.. as did SAS.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
|