Page 186 - Applied Statistics Using SPSS, STATISTICA, MATLAB and R
P. 186

166      4 Parametric Tests of Hypotheses


              As mentioned in Commands 4.5 be sure to check the No intercept   box in
           STATISTICA (Options   tab) and uncheck  Include intercept in model
           in SPSS  (General Linear Model, Model        tab). In STATISTICA the
           Sigma-restricted     box must also be unchecked; the model will then be the
           Type III   orthogonal model.
              The meanings of most arguments and return values of  anova2   MATLAB
           command are the same as  in Commands 4.5. The argument reps   indicates the
           number of observations per cell. For instance, the two-way ANOVA analysis of
           Example 4.19 would  be performed in MATLAB using a  matrix  x  containing
           exactly the data shown in Figure 4.18a, with the command:

              » anova2(x,4)

              The same results shown in Table 4.21 are obtained.
              Let us now illustrate how to use the R anova   function in order to perform two-
           way ANOVA tests. For this purpose we assume that a data frame with the data of
           Example 4.19 has been created with the column names f1  , f2   and X  as in the left
           picture of Figure 4.18. The first thing to do (as we did in Commands 4.5) is to
           convert f1   and f2   into factors with:

              > f1f <- factor(f1,labels = c(“1”, 2”, 3”))
                                                      “
                                                           “
              > f2f <- factor(f2,labels = c(“1”, 2”))
                                                      “

              We now obtain the two-way ANOVA similar to Table 4.21 using:

              > anova(lm(X~f1f*f2f))

              A model  without interaction effects can  be  obtained  with  anova( lm(X~
           f1f+f2f))   (for details see the help on lm  )


           Exercises


           4.1   Consider the meteorological dataset used in Example 4.1. Test whether 1980 and 1982
               were atypical years with respect to the average maximum temperature. Use the same
               test value as in Example 4.1.

           4.2   Show that the alternative hypothesis µ T 81  =  39  8 .  for Example 4.3 has a high power.
               Determine the smallest deviation from the test value  that provides at  least a 90%
               protection against Type II Errors.

           4.3   Perform the computations of the powers and critical region thresholds for the one-sided
               test examples used to illustrate the RS and AS situations in section 4.2.

           4.4  Compute the power curve corresponding to Example 4.3 and compare it with the curve
               obtained with STATISTICA or SPSS. Determine for which deviation of the null
               hypothesis “typical” temperature one obtains a reasonable protection (power > 80%)
               against alternative hypothesis.
   181   182   183   184   185   186   187   188   189   190   191