Page 211 - Computational Statistics Handbook with MATLAB
P. 211

198                        Computational Statistics Handbook with MATLAB


                             ability of the hypothesis test to detect a false null hypothesis. The power is
                             given by


                                                        Power =  1 –  β  .                  (6.2)

                             As we see in Example 6.3, the power of the test to detect departures from the
                                                                     µ
                             null hypothesis depends on the true value of  .

                             Example 6.3
                             Returning to the transportation example, we illustrate the concepts of Type II
                             error and power. It is important to keep in mind that these values depend on
                             the true mean µ,   so we have to calculate the Type II error for different values
                             of µ.   First we get a vector of values for µ:
                                % Get several values for the mean under the alternative
                                % hypothesis. Note that we are getting some values
                                % below the null hypothesis.
                                mualt = 40:60;
                             It is actually easier to understand the power when we look at a test statistic
                                     x
                             based on   rather than z .   So, we convert the critical value to its correspond-
                                                  o
                             ing  value:
                                x
                                % Note the critical value:
                                cv = 1.645;
                                % Note the standard deviation for x-bar:
                                sig = 1.5;
                                % It's easier to use the non-standardized version,
                                % so convert:
                                ct = cv*1.5 + 45;
                             We find the area under the curve to the left of the critical value (the non rejec-
                             tion region) for each of these values of the true mean. That would be the prob-
                             ability of not rejecting the null hypothesis.

                                % Get a vector of critical values that is
                                % the same size as mualt.
                                ctv = ct*ones(size(mualt));
                                % Now get the probabilities to the left of this value.
                                % These are the probabilities of the Type II error.
                                beta = normcdf(ctv,mualt,sig);
                             Note that the variable beta contains the probability of Type II error (the area
                             to the left of the critical value ctv under a normal curve with mean mualt
                                                                µ
                             and standard deviation sig) for every  . To get the power, simply subtract
                             all of the values for beta from one.
                                % To get the power: 1-beta




                             © 2002 by Chapman & Hall/CRC
   206   207   208   209   210   211   212   213   214   215   216