# [R] Hypothesis test

JRG loesljrg at accucom.net
Sat Apr 7 13:08:25 CEST 2001

From:           	"Moustafa ElHousinie" <drhosini at hotmail.com>
To:             	r-help at stat.math.ethz.ch
Copies to:      	syed at saudionline.com.sa
Subject:        	Re: [R] Hypothesis test
Date sent:      	Sat, 07 Apr 2001 06:33:16 -0000

> Dear colleague:
>
> Actually that is what is done.
>
> When using the z-test between proportions in two different groups, or using
> chi-squared to test the null hypothesis of equal proportions of two or more
> groups, the null hypothesis is that
>
> H0: p1=p2=p3.....=p
>

<<SNIP>>
> Mostafa
>

Ahem.  I believe this is not the question originally posed:
>
>
> >From: "syed gillani" <syed at saudionline.com.sa>
> >To: <r-help at stat.math.ethz.ch>
> >Subject: [R] Hypothesis test
> >Date: Sat, 7 Apr 2001 06:11:42 +0300
> >
> >Hello,
> >
> >Is it reasonable to run a test of significance regarding a proportion in a
> >group versus that in the whole population?
> >What kind of problems can one face in analysis?

That would seem to be:  How do I test Ho: p = p0 for some fixed
value of p0, given an observed proportion p-hat (based on a
sample of size n)?

Answer:  Calculate a p-value directly from the binomial distribution
B(n, p0) or, if min(n*p0, n*(1-p0)) is not too small, use the normal
approximation based on

z = (p-hat - p0) / sqrt(p0*(1-p0)/n)

To that z you may or may not want to add a continuity correction,
depending on your position on that particular issue.

Both tests assume that n is small compared to the population size,
are standard fare in intro textbooks, and easily calculated from R's
command line.

---JRG

John R. Gleason

Syracuse University
430 Huntington Hall                      Voice:   315-443-3107
Syracuse, NY 13244-2340  USA             FAX:     315-443-4085

PGP public key at keyservers
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._