01.03.2013 Views

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

Applied Statistics Using SPSS, STATISTICA, MATLAB and R

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

166 4 Parametric Tests of Hypotheses<br />

As mentioned in Comm<strong>and</strong>s 4.5 be sure to check the No intercept box in<br />

<strong>STATISTICA</strong> (Options tab) <strong>and</strong> uncheck Include intercept in model<br />

in <strong>SPSS</strong> (General Linear Model, Model tab). In <strong>STATISTICA</strong> the<br />

Sigma-restricted box must also be unchecked; the model will then be the<br />

Type III orthogonal model.<br />

The meanings of most arguments <strong>and</strong> return values of anova2 <strong>MATLAB</strong><br />

comm<strong>and</strong> are the same as in Comm<strong>and</strong>s 4.5. The argument reps indicates the<br />

number of observations per cell. For instance, the two-way ANOVA analysis of<br />

Example 4.19 would be performed in <strong>MATLAB</strong> using a matrix x containing<br />

exactly the data shown in Figure 4.18a, with the comm<strong>and</strong>:<br />

» anova2(x,4)<br />

The same results shown in Table 4.21 are obtained.<br />

Let us now illustrate how to use the R anova function in order to perform twoway<br />

ANOVA tests. For this purpose we assume that a data frame with the data of<br />

Example 4.19 has been created with the column names f1, f2 <strong>and</strong> X as in the left<br />

picture of Figure 4.18. The first thing to do (as we did in Comm<strong>and</strong>s 4.5) is to<br />

convert f1 <strong>and</strong> f2 into factors with:<br />

> f1f f2f anova(lm(X~f1f*f2f))<br />

A model without interaction effects can be obtained with anova(lm(X~<br />

f1f+f2f)) (for details see the help on lm)<br />

<br />

Exercises<br />

4.1 Consider the meteorological dataset used in Example 4.1. Test whether 1980 <strong>and</strong> 1982<br />

were atypical years with respect to the average maximum temperature. Use the same<br />

test value as in Example 4.1.<br />

4.2 Show that the alternative hypothesis µ T 81 = 39.<br />

8 for Example 4.3 has a high power.<br />

Determine the smallest deviation from the test value that provides at least a 90%<br />

protection against Type II Errors.<br />

4.3 Perform the computations of the powers <strong>and</strong> critical region thresholds for the one-sided<br />

test examples used to illustrate the RS <strong>and</strong> AS situations in section 4.2.<br />

4.4 Compute the power curve corresponding to Example 4.3 <strong>and</strong> compare it with the curve<br />

obtained with <strong>STATISTICA</strong> or <strong>SPSS</strong>. Determine for which deviation of the null<br />

hypothesis “typical” temperature one obtains a reasonable protection (power > 80%)<br />

against alternative hypothesis.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!