Question 160128
Find the sample proportions and test statistic for equal proportions. Is the decision close? Find the p-value.

a. Dissatisfied workers in two companies: x1 = 40, n1 = 100, x2 = 30, n2 = 100, α = .05, two tailed test.
<pre><font size = 4 color="indigo"><b>
1.  Set up the hypotheses:

{{{matrix(1,3,H[0],":",p[1]=p[2])}}}
{{{matrix(1,3,H[1],":",p[1]<>p[2])}}}

or, equivalently,

{{{matrix(1,3,H[0],":",p[1]-p[2]=0)}}}
{{{matrix(1,3,H[0],":",p[1]-p[2]<>0)}}}

2. Determine the critical region for the test statistic Z:

Since {{{alpha=.05}}}, for rejection of {{{H[0]}}}, and since
this is a 2-tailed test, we require that either {{{Z<-1.96}}} 
or {{{Z>1.96}}}

3.  Calculate the three "p-hats":

[Note: I can't put a hat on {{{p}}} on here, so I will 
write {{{ph[1]}}} for the point estimate of {{{p[1]}}},
{{{ph[2]}}} for the point estimate of {{{p[2]}}}, and
{{{ph}}} for the pooled estimate of {{{p}}}.  The {{{h}}}
stands for "hat".

{{{ph[1]=x[1]/n[1]=40/100=.4}}} and {{{ph[2]=x[2]/n[2]=30/100=.3}}}

{{{ph=(x[1]+x[2])/(n[1]+n[2])= (40+30)/(100+100)=70/200=.35}}}

4.  Calculate {{{Z}}} the test-statistic by this
terrible formula:

{{{Z=(ph[1]-ph[2])/(sqrt(ph(1-ph))*sqrt(1/n[1]+1/n[2]))}}}

{{{Z=(.4-.3)/(sqrt(.35(1-.35))*sqrt(1/100+1/100))}}}

{{{Z=(.1)/(sqrt(.35(.65))*sqrt(2/100))}}}

{{{Z=(.1)/(sqrt(.2275)*sqrt(.02))}}}

{{{Z=1.48}}}

This is not in the rejection-region so we cannot
reject the hypothesis that the proportions of
dissatisfied workers are equal in the two
companies.  So, yes the decision that they are
close is good.

------

The p-value is the probability that the test
statistic Z would be either at least as high as 
1.48 or at least as low as -1.48, if in fact
the two proportions were equal:

So we use a standard normal table to find the
area to the left of z=-1.48, which is .0694.
That's the probability that it is at least as
low as 1.48.  The prbability that it is at
least as high as +1.48 is the same so we 
double the value .0694 and get a p-value of
.1388.

Since this p-value is greater than .05, this
is another way to determine that we cannot
reject {{{H[0]}}}, so the proportions are
closely the same.

Now if you have a TI-83 or 84 calculator,
you could just clear the screen and do this:

press STAT
use arrow keys to move cursor to hilite TESTS
press 6
beside x1: type 40
beside n1: type 100
beside x2: type 30
beside n2: type 100
beside p1: place cursor on{{{matrix(1,1,_<>p2)}}}  
press ENTER
press cursor on Calculate
press ENTER

You see

2-propZtest
{{{p1<>p2}}}
{{{z=1.482498633}}}
{{{p=.1382077316}}}
p(hat)1=.4
p(hat)2=.3
p(hat)=.35

Notice that the p-value found by the table was .1388, and
the p-value found by calculator was .1382077316, but that
difference is because with the table we have to round the
z-value from 1.482498633 to 1.48.    

----------------------------------------------------------
</pre></font></b>
b. Rooms rented at least a week in advance at two hotels: x1 = 24, n1 = 200, x2 = 12, n2 = 50, &#945; = .01, left-tailed test.
<pre><font size = 4 color="indigo"><b>
1.  Set up the hypotheses:

{{{matrix(1,3,H[0],":",p[1]=p[2])}}}
{{{matrix(1,3,H[1],":",p[1]<p[2])}}}

or, equivalently,

{{{matrix(1,3,H[0],":",p[1]-p[2]=0)}}}
{{{matrix(1,3,H[0],":",p[1]-p[2]<0)}}}

2. Determine the critical region for the test statistic Z:

Since {{{alpha=.01}}}, for rejection of {{{H[0]}}}, and since
this is a left-tailed test, we require that {{{Z<-2.33}}},
since -2.33 is the z-value that has the area .01 to the left 
of it.

3.  Calculate the three "p-hats" same as the other problem:

{{{ph[1]=x[1]/n[1]=24/200=.12}}} and {{{ph[2]=x[2]/n[2]=12/50=.24}}}

{{{ph=(x[1]+x[2])/(n[1]+n[2])= (24+12)/(200+50)=36/250=.144}}}

4.  Calculate {{{Z}}} the test-statistic by the same
terrible formula:

{{{Z=(ph[1]-ph[2])/(sqrt(ph(1-ph))*sqrt(1/n[1]+1/n[2]))}}}

{{{Z=(.12-.24)/(sqrt(.144(1-.144))*sqrt(1/200+1/50))}}}

{{{Z=(-.12)/(sqrt(.144(.856))*sqrt(.025))}}}

{{{Z=(-.12)/(sqrt(.123264)*sqrt(.025))}}}

{{{Z=-2.16}}}

This is not in the rejection-region so we cannot
reject the hypothesis that the proportions of
rooms rented at least a week in advance are equal 
in the two hotels.  So, yes the decision that they 
are close is good.

The p-value is the probability that the test
statistic Z would be at least as low as -2.16, 
if in fact the two proportions were equal:

So we use a standard normal table to find the
area to the left of z=-2.16, which is .0154.
That's the probability that it is at least as
low as -2.16.  So that is the p-value.  [We
only double in the case of a two-tailed test.]

Since this p-value is greater than .01, this
is another way to determine that we cannot
reject {{{H[0]}}}, so the proportions are
closely the same.

Now if you have a TI-83 or 84 calculator,
you could just clear the screen and do this:

press STAT
use arrow keys to move cursor to hilite TESTS
press 6
beside x1: type 24
beside n1: type 200
beside x2: type 12
beside n2: type 50
beside p1: place cursor on{{{matrix(1,1,_<p2)}}}  
press ENTER
put cursor on Calculate
press ENTER

You see

2-propZtest
{{{p1<p2}}}
{{{z=-2.161688506}}}
{{{p=.0153210422}}}
p(hat)1=.12
p(hat)2=.24
p(hat)=.144

Notice that the p-value found by the table was .0154, and
the p-value found by calculator was 0153210422, but that
difference is because with the table we have to round the
z-value from -2.161688506 to -2.16.  That's not as big a
round-off error as in the preceding problem, so it wasn't
as far off.     

----------------------------------------------------------
</pre></font></b>
c. Home equity loan default rates in two banks: x1 = 36, n1 = 480, x2 = 26, n2 = 520, &#945; = .05, right-tailed test.
<pre><font size = 4 color="indigo"><b>
1.  Set up the hypotheses:

{{{matrix(1,3,H[0],":",p[1]=p[2])}}}
{{{matrix(1,3,H[1],":",p[1]>p[2])}}}

or, equivalently,

{{{matrix(1,3,H[0],":",p[1]-p[2]=0)}}}
{{{matrix(1,3,H[0],":",p[1]-p[2]>0)}}}

2. Determine the critical region for the test statistic Z:

Since {{{alpha=.05}}}, for rejection of {{{H[0]}}}, and since
this is a left-tailed test, we require that {{{Z>1.64}}},
since 1.64 is the z-value that has the area .05 to the right 
of it.

3.  Calculate the three "p-hats" same as the other 2 problems:

{{{ph[1]=x[1]/n[1]=36/480=.075}}} and {{{ph[2]=x[2]/n[2]=26/520=.05}}}

{{{ph=(x[1]+x[2])/(n[1]+n[2])= (36+26)/(480+520)=62/1000=.062}}}

4.  Calculate {{{Z}}} the test-statistic by the same
terrible formula:

{{{Z=(ph[1]-ph[2])/(sqrt(ph(1-ph))*sqrt(1/n[1]+1/n[2]))}}}

{{{Z=(.075-.05)/(sqrt(.062(1-.062))*sqrt(1/480+1/520))}}}

{{{Z=(.025)/(sqrt(.062(.938))*sqrt(.004))}}}

{{{Z=(.025)/(sqrt(.058156)*sqrt(.004))}}}

{{{Z=1.64}}}

This is exactly at the boundary of the rejection-region so 
it is really a toss-up as to whether we should reject the 
hypothesis that the propportions of loan default-rates are 
equal at the two banks.  So, this test is a failure.  We
would need more data.

The p-value is the probability that the test
statistic Z would be at least as high as 1.64, 
if in fact the two proportions were equal:

So if we use a standard normal table to find the
area to the right of z=1.64, we should find it to
be {{{alpha=.05}}} which is what we expect to happen
whenever the test-statistic turns out to be the same
as the boundary of the rejection region, as it did in
his case.

Now if you have a TI-83 or 84 calculator,
we will be much more accurate.  Just clear the screen 
and do this:

press STAT
use arrow keys to move cursor to hilite TESTS
press 6
beside x1: type 36
beside n1: type 480
beside x2: type 26
beside n2: type 520
beside p1: place cursor on{{{matrix(1,1,_>p2)}}}  
press ENTER
put cursor on Calculate
press ENTER

You see

2-propZtest
{{{p1>p2}}}
{{{z=1.63781572}}}
{{{p=.050730057}}}
p(hat)1=.075
p(hat)2=.05
p(hat)=.062

Notice that the p-value found with the calculator is
very slightly more than .05, so according to this
more accurate calculation, we should not reject {{{H[0]}}}.
However it is still so very close to .05 that more data 
should be obtained before a decision is made.

Edwin</pre>