For the variable PHE, we reject the hypothesis of equal variances; therefore, we look to the t test results in the bottom row, which are based on formulas 4.14 and 4.15. The null hypothesis of equal means is also rejected, now with higher significance since p = 0.002. Note that the means of the two groups are more than three times the standard error apart. ± Figure 4.10. a) Window of STATISTICA Power Analysis module used for the specifications of Example 4.10; b) Results window for the previous specifications. Example 4.10 Q: Compute the power for the ASP variable (aspartame content) of the previous Example 4.9, for a one-sided test at 5% level, assuming that as an alternative hypothesis white wines have more aspartame content than red wines. Determine what is the minimum distance between the population means that guarantees a power above 90% under the same conditions as the studied samples. A: The one-sided test for this RS situation (see section 4.2) is formalised as: H 0 : µ 1 ≤ µ 2 ; H 1 : µ 1 > µ 2 . (White wines have more aspartame than red wines.) The observed level of significance is half of the value shown in Table 4.6, i.e., p = 0.011; therefore, the null hypothesis is rejected at the 5% level. When the data analyst investigated the ASP variable, he wanted to draw conclusions with protection against a Type II Error, i.e., he wanted a low probability of wrongly not detecting the alternative hypothesis when true. Figure 4.10a shows the
4.4 Inference on Two Populations 137 STATISTICA specification window needed for the power computation. Note the specification of the one-sided hypothesis. Figure 4.10b shows that the power is very high when the alternative hypothesis is formalised with population means having the same values as the sample means; i.e., in this case the probability of erroneously deciding H 0 is negligible. Note the computed value of the standardised effect ( µ 1 – µ 2 )/s = 2.27, which is very large (see section 4.2). Figure 4.11 shows the power curve depending on the standardised effect, from where we see that in order to have at least 90% power we need E s = 0.75, i.e., we are guaranteed to detect aspartame differences of about 2 mg/l apart (precisely, 0.75 × 2.64 = 1.98). ± 0.0 0.5 1.0 1.5 2.0 2.5 .3 .4 .5 .6 .7 .8 .9 1.0 Power Standardized Effect (Es) Power vs. Es (N1 = 30, N2 = 37, Alpha = 0.05) Figure 4.11. Power curve, obtained with STATISTICA, for the wine data Example 4.10. Commands 4.3. SPSS, STATISTICA, MATLAB and R commands used to perform the two independent samples t test. SPSS Analyze; Compare Means; Independent Samples T Test STATISTICA Statistics; Basic Statistics and Tables; t-test, independent, by groups MATLAB [h,sig,ci] = ttest2(x,y,alpha,tail] R t.test(formula, var.equal = FALSE) The MATLAB function ttest2 works in the same way as the function ttest described in 4.3.1, with x and y representing two independent sample vectors. The function ttest2 assumes that the variances of the samples are equal.
138 4 Parametric Tests of Hypotheses The R function t.test , already mentioned in Commands 4.1, can also be used to perform the two-sample t test. This function has several arguments the most important of which are mentioned above. Let us illustrate its use with Example 4.9.