Statistics/Testing Data/z-tests2

Indications
The Null Hypothesis should be an assumption about the difference in the population means for two populations (note that the same quantitative variable must have been measured in each population). The data should consist of two samples of quantitative data (one from each population). The samples must be obtained independently from each other.

Requirements
The samples must be drawn from populations which have known Standard Deviations (or Variances). Also, the measured variable in each population (generically denoted x1 and x2) should have a Normal Distribution.

Note that if the distributions of the variables in the populations are non-normal (or unknown), the two-sample z-test can still be used for approximate results, provided the combined sample size (sum of sample sizes) is sufficiently large. Historically, a combined sample size of at least 30 has been considered sufficiently large; reality is (of course) much more complicated, but this rule of thumb is still in use in many textbooks.

Procedure

 * The Null Hypothesis:


 * H0 : &mu;1 - &mu;2 = &delta;

in which &delta; is the supposed difference in the expected values under the null hypothesis.


 * The Alternate Hypothesis:


 * H0 : &mu;1 - &mu;2 &lt; &delta;


 * H0 : &mu;1 - &mu;2 &gt; &delta;


 * H0 : &mu;1 - &mu;2 &ne; &delta;

For more information about the Null and Alternate Hypotheses, see the page on the z test for a single mean.


 * The Test Statistic:


 * $$z=\frac{(\bar{x}_1 - \bar{x}_2) - \delta}{\sqrt{\frac{\sigma _1^2}{n_1}+\frac{\sigma _2^2}{n_2}}}$$

Usually, the null hypothesis is that the population means are equal; in this case, the formula reduces to


 * $$z= \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\frac{\sigma _1^2}{n_1}+\frac{\sigma _2^2}{n_2}}}$$

In the past, the calculations were simpler if the Variances (and thus the Standard Deviations) of the two populations could be assumed equal. This process is called Pooling, and many textbooks still use it, though it is falling out of practice (since computers and calculators have all but removed any computational problems).


 * $$\frac{\bar{x}_1 - \bar{x}_2}

{\sigma \sqrt{\frac{1}{n_1} + \frac{1}{n_2}}} $$


 * The Significance (p-value)

Calculate the probability of observing a value of z (from a Standard Normal Distribution) using the Alternate Hypothesis to indicate the direction in which the area under the Probability Density Function is to be calculated. This is the Attained Significance, or p-value.

Note that some (older) methods first chose a Level Of Significance, which was then translated into a value of z. This made more sense (and was easier!) in the days before computers and graphics calculators.


 * Decision

The Attained Significance represents the probability of obtaining a test statistic as extreme, or more extreme, than ours&mdash;if the null hypothesis is true.

If the Attained Significance (p-value) is sufficiently low, then this indicates that our test statistic is unusual (rare)&mdash;we usually take this as evidence that the null hypothesis is in error. In this case, we reject the null hypothesis.

If the p-value is large, then this indicates that the test statistic is usual (common)&mdash;we take this as a lack of evidence against the null hypothesis. In this case, we fail to reject the null hypothesis.

It is common to use 5% as the dividing line between the common and the unusual; again, reality is more complicated.

Do Professors Make More Money at Larger Universities?
Universities and colleges in the United States of America are categorized by the highest degree offered. Type IIA institutions offer a Master's Degree, and type IIB institutions offer a Baccalaureate degree. A professor, looking for a new position, wonders if the salary difference between type IIA and IIB institutions is really significant.

He finds that a random sample of 200 IIA institutions has a mean salary (for full professors) of $54,218.00, with standard deviation $8,450. A random sample of 200 IIB institutions has a mean salary (for full professors) of $46,550.00, with standard deviation $9,500 (assume that the sample standard deviations are in fact the population standard deviations).

Do these data indicate a significantly higher salary at IIA institutions?

The null hypothesis is that there is no difference; thus


 * H0 : &mu;A = &mu;B

(where &mu;A is the true mean full professor salary at IIA institutions, and &mu;B is the mean at IIB institutions)

He is looking for evidence that IIA institutions have a higher mean salary; thus the alternate hypothesis is


 * H1 : &mu;A &gt; &mu;B

Since the hypotheses concern means from independent samples (we'll assume that these are independent samples), a two sample test is indicated. The samples are large, and the standard deviations are known (assumed?), so a two sample z-test is appropriate.


 * $$z=\frac{\mu _A -\mu _B}{\sqrt{\frac{\sigma _A ^2}{n _A}+\frac{\sigma _B ^2}{n _B}}}=

\frac{54218-46550}{\sqrt{\frac{8450 ^2}{200}+\frac{9500 ^2}{200}}}= 8.5292$$

Now we find the area to the right of z = 8.5292 in the Standard Normal Distribution. This can be done with a table of values or software&mdash;I get 0.

If the null hypothesis is true, and there is no difference in the salaries between the two types of institutions, then the probability of obtaining samples where the mean for IIA institutions is at least $7,668 higher than the mean for IIB institutions is essentially zero. This occurs far too rarely to attribute to chance variation; it seems quite unusual. I reject the null hypothesis (at any reasonable level of significance!).

It appears that IIA schools have a significantly higher salary than IIB schools.

Example 2
A student scored 65 on a calculus test that had a mean of 50 and a standard deviation of 10; she scored 30 on history test with a mean of 25 and a standard deviation of 5.compare her relative position on the two tests?