TI-BASIC:2 Propztest

From Learn @ Cemetech
Jump to: navigation, search

2-PROPZTEST.GIF

Command Summary

Performs a z-test to compare two proportions.

Command Syntax

2-PropZTest(x,,1,,, n,,1,,, x,,2,,, n,,2,,, [alternative, draw?]

Menu Location

While editing a program, press:

  1. STAT to access the statistics menu
  2. LEFT to access the TESTS submenu
  3. 6 to select 2-PropZTest, or use arrows

(outside the program editor, this will select the 2-PropZTest... interactive solver)

Calculator Compatibility

TI-83/84/+/SE

Token Size

2 bytes

2-PropZTest performs an z-test to compare two population proportions. This test is valid for sufficiently large samples: only when the number of successes (x in the command syntax) and the number of failures (n-x) are both >5, for both populations.

The logic behind the test is as follows: we want to test the hypothesis that the proportions are equal (the null hypothesis). To do this, we assume that this "null hypothesis" is true, and calculate the probability that the differences between the two proportions occurred, under this assumption. If this probability is sufficiently low (usually, 5% is the cutoff point), we conclude that since it's so unlikely that the data could have occurred under the null hypothesis, the null hypothesis must be false, and therefore the proportions are not equal. If, on the other hand, the probability is not too low, we conclude that the data may well have occurred under the null hypothesis, and therefore there's no reason to reject it.

Commonly used notation has the letters π,,1,, and π,,2,, being used for the true population proportions (making the null hypothesis be π,,1,,=π,,2,,). TI must have been afraid that this would be confused with the real number π, so on the calculator, "p1" and "p2" are used everywhere instead.

In addition to the null hypothesis, we must have an alternative hypothesis as well - usually this is simply that the proportions are not equal. However, in certain cases, our alternative hypothesis may be that one proportion is greater or less than the other.

The arguments to 1-PropZTest( are as follows:

  • x,,1,, - the success count in the first sample
  • n,,1,, - the total size of the first sample (so the sample proportion would be x,,1,,/n,,1,,)
  • x,,2,, - the success count in the second sample
  • n,,2,, - the total size of the second sample (so the sample proportion would be x,,2,,/n,,2,,)
  • alternative (optional if you don't include draw?) - determines the alternative hypothesis
    • 0 (default value) - p1≠p2
    • -1 (or any negative value) - p1<p2
    • 1 (or any positive value) - p1>p2
  • draw? (optional) set this to 1 if you want a graphical rather than numeric result

Although you can access the 1-PropZTest command on the home screen, via the catalog, there's no need: the 1-PropZTest... interactive solver, found in the statistics menu, is much more intuitive to use - you don't have to memorize the syntax.

In either case, it's important to understand the output of 1-PropZTest. Here are the meanings of each line:

  • The first line, involving p1 and p2, is the alternative hypothesis.
  • z is the test statistic. If the null hypothesis is true, it should be close to 0.
  • p is the probability that the difference between the two proportions would occur if the null hypothesis is true. When the value is sufficiently small, we reject the null hypothesis and conclude that the alternative hypothesis is true. You should have a cutoff value ready, such as 5% or 1%. If p is lower, you "reject the null hypothesis on a 5% (or 1%) level" in technical terms.
  • p-hat,,1,, is the sample proportion x,,1,,/n,,1,,.
  • p-hat,,2,, is the sample proportion x,,2,,/n,,2,,.
  • p-hat is the total sample proportion
  • n,,1,, is the first sample size.
  • n,,2,, is the second sample size.

Advanced Uses

The final optional argument of 2-PropZTest, draw?, will display the results in a graphical manner if you put in "1" for it. The calculator will draw the standard normal distribution, and shade the area of the graph that corresponds to the probability p. In addition, the value of z and the value of p will be displayed. You would make your conclusions in the same way as for the regular output.

Optimization

Some of the arguments of the 2-PropZTest command have default values, and the argument can be omitted if this value is used.

  • The draw? argument can be omitted if you don't want graphical output, although you could put "0" in as well.
  • If the above argument is omitted, and you're doing a two sided test, you may omit the alternative argument.

Example:

:2-PropZTest(22,50,48,100,0,0
can be
:2-PropZTest(22,50,48,100


Related Commands