]> Tests in the Bernoulli Model
  1. Virtual Laboratories
  2. 8. Hypothesis Testing
  3. 1
  4. 2
  5. 3
  6. 4
  7. 5
  8. 6
  9. 7

3. Tests in the Bernoulli Model

Preliminaries

Suppose that X X 1 X 2 X n is a random sample from the Bernoulli distribution with unknown success parameter p 0 1 . Thus, these are independent random variables taking the values 1 and 0 with probabilities p and 1 p respectively. Usually, this model arises in one of the following contexts:

  1. There is an event of interest in a basic experiment, with unknown probability p . We replicate the experiment n times and define X i 1 if and only if the event occurred on run i .
  2. We have a population of objects of several different types; p is the unknown proportion of objects of a particular type of interest. We select n objects at random from the population and let X i 1 if and only if object i is of the type of interest. When the sampling is with replacement, these variables really do form a random sample from the Bernoulli distribution. When the sampling is without replacement, the variables are dependent, but the Bernoulli model may still be approximately valid. For more on these points, see the discussion of sampling with and without replacement in the chapter on Finite Sampling Models.

In this section, we will construct hypothesis tests for the parameter p . The parameter space for p is the interval 0 1 , and all hypotheses define subsets of this space. This section parallels the section on Estimation in the Bernoulli Model in the Chapter on Interval Estimation.

Tests of p

The Binomial Test

Recall that the number of successes

Y i 1 n X i

has the binomial distribution with parameters n and p and has mean Y n p and variance Y n p 1 p . Moreover, recall that Y is sufficient for p . For α 0 1 , let b n p α denote the quantile of order α for the binomial distribution with parameters n and p . Since the binomial distribution is discrete, only certain (exact) quantiles are possible.

Show that for any α 0 1 and r 0 1 , the following tests have significance level α :

  1. Reject p p 0 versus p p 0 if and only if Y b n p 0 α r α or Y b n p 0 1 r α
  2. Reject p p 0 versus μ p 0 if and only if Y b n p 0 α
  3. Reject p p 0 versus p p 0 if and only if Y b n p 0 1 α

As usual, of the two-sided tests in part (a), the unbiased test with r 12 is most commonly used:

Reject p p 0 versus p p 0 if and only if Y b n p 0 α 2 or Y b n p 0 1 α 2 .

An Approximate Normal Test

When n is large, the distribution of Y is approximately normal, by the central limit theorem. Thus, an approximate normal test can be constructed using the test statistic

Z p 0 Y n p 0 n p 0 1 p 0

Note that Z p 0 is the standard score of Y if p p 0 . As usual, for α 0 1 , let z α denote the quantile of order α for the standard normal distribution. For selected values of α , z α can be obtained from the last row of the table of the t distribution, from the table of the standard normal distribution, from the quantile applet, or from most statistical software packages. Recall also by symmetry that z 1 α z α

Show that for any α 0 1 and r 0 1 , the following tests have significance level α :

  1. Reject p p 0 versus p p 0 if and only if Z p 0 z α r α or Z p 0 z 1 r α
  2. Reject p p 0 versus p p 0 if and only if Z p 0 z α
  3. Reject p p 0 versus p p 0 if and only if Z p 0 z 1 α

As usual, of the two-sided tests in part (a), the unbiased test with r 12 is most commonly used:

Reject p p 0 versus p p 0 if and only if Z p 0 z α 2 or Z p 0 z 1 α 2

Simulation Exercises

In the proportion test experiment, set p p 0 , and select sample size 10, significance level 0.1, and p 0 0.5 . For each p 0.1 0.2 0.9 , run the experiment 1000 times, updating every 10 runs, and then note the relative frequency of rejecting the null hypothesis. Graph the empirical power function.

In the proportion test experiment, repeat the previous exercise with sample size 20.

In the proportion test experiment, set p p 0 , and select sample size 15, significance level 0.05, and p 0 0.3 . For each p 0.1 0.2 0.9 , run the experiment 1000 times, updating every 10 runs, and then note the relative frequency of rejecting the null hypothesis. Graph the empirical power function.

In the proportion test experiment, repeat the previous exercise with sample size 30.

In the proportion test experiment, set p p 0 , and select sample size 20, significance level 0.01, and p 0 0.6 . For each p 0.1 0.2 0.9 , run the experiment 1000 times, updating every 10 runs, and then note the relative frequency of rejecting the null hypothesis. Graph the empirical power function.

In the proportion test experiment, repeat the previous exercise with sample size 50.

Computational Exercises

In a pole of 1000 registered voters in a certain district, 427 prefer candidate X. At the 0.1 level, is the evidence sufficient to conclude that more that 40% of the registered voters prefer X?

A coin is tossed 500 times and results in 302 heads. At the 0.05 level, test to see if the coin is unfair.

A sample of 400 memory chips from a production line are tested, and 32 are defective. At the 0.05 level, test to see if the proportion of defective chips is less than 0.1.

A new drug is administered to 50 patients and the drug is effective in 42 cases. At the 0.1 level, test to see if the success rate for the new drug is greater that 0.8.

Using the M&M data, test the following alternative hypotheses at the 0.1 significance level:

  1. The proportion of red M&Ms differs from 16 .
  2. The proportion of green M&Ms is less than 16 .
  3. The proportion of yellow M&M is greater than 16

The Sign Test

Suppose now that we have a basic random experiment with a real-valued random variable U of interest. We assume that X has a continuous distribution with support on an interval of . Let p 0 1 , and let m denote quantile of order p for the distribution of U . Thus, by definition,

p P U m

Suppose that m is unknown and that we want to construct hypothesis tests for m . For a given test value m 0 , let

p 0 P U m 0

Show that

  1. m m 0 if and only if p p 0 .
  2. m m 0 if and only if p p 0 .
  3. m m 0 if and only if p p 0 .

As usual, we repeat the basic experiment n times to generate a random sample U U 1 U 2 U n of size n from the distribution of U . Let X i be the indicator variable of the event U i m for i 1 2 n .

Show that X X 1 X 2 X n is a random sample of size n from the Bernoulli distribution with parameter p .

From Exercises 14 and 15, tests of the unknown quantile m can be converted to tests of the Bernoulli parameter p , and thus the tests developed in the previous subsections apply. This procedure is known as the sign test, because essentially, only the sign of U i m 0 is recorded for each i . This procedure is also an example of a nonparametric test, because no assumptions about the distribution of U are made (except for continuity). In particular, we do not need to assume that the distribution of U belongs to a particular parametric family.

The most important special case of the sign test is the case where p 0 12 ; this is the sign test of the median. If the distribution of U is known to be symmetric, the median and the mean agree. In this case, sign tests of the median are also tests of the mean.

Simulation Exercises

In the sign test experiment, set the sampling distribution to normal with mean 0 and standard deviation 2. Set the sample size to 10 and the significance level to 0.1. For each of the 9 values of m 0 , run the simulation 1000 times, updating every 10 runs.

  1. When m m 0 , give the empirical estimate of the significance level of the test and compare with 0.1.
  2. In the other cases, give the empirical estimate of the power of the test.

In the sign test experiment, set the sampling distribution to uniform on the interval 0 5 . Set the sample size to 20 and the significance level to 0.05. For each of the 9 values of m 0 , run the simulation 1000 times, updating every 10 runs.

  1. When m m 0 , give the empirical estimate of the significance level of the test and compare with 0.05.
  2. In the other cases, give the empirical estimate of the power of the test.

In the sign test experiment, set the sampling distribution to gamma with shape parameter 2 and scale parameter 1. Set the sample size to 30 and the significance level to 0.025. For each of the 9 values o m 0 , run the simulation 1000 times, updating every 10 runs.

  1. When m m 0 , give the empirical estimate of the significance level of the test and compare with 0.025.
  2. In the other cases, give the empirical estimate of the power of the test.

Computational Exercises

Using the M&M data, test to see if the median weight exceeds 47.9 grams, at the 0.1 level.

Using Fisher's iris data, perform the following tests, at the 0.1 level:

  1. The median petal length of Setosa irises differs from 15 mm.
  2. The median petal length of Verginica irises is less than 52 mm.
  3. The median petal length of Versicolor irises is less than 42 mm.