10.07.2015 Views

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Analysis of variance 31911.24 The data set normtemp (<strong>Using</strong>R) contains body temperature and heart rate (hr)<strong>for</strong> 65 randomly chosen males and 65 randomly chosen females (marked by gender with1 <strong>for</strong> males and 2 <strong>for</strong> females). Per<strong>for</strong>m an ANCOVA modeling temperature by heart ratewith gender treated as a factor.11.4 Two-way ANOVA“Two-way analysis of variance” is the term given when a numeric response variable ismodeled by two categorical predictors. After we fit the model into the regressionframework, the t-tests and partial F test will be available <strong>for</strong> analysis.Let Y be the response variable and x 1 and x 2 be two categorical predictors, with n 1 andn 2 levels respectively. The simplest generalization of the one-way ANOVA model (11.4)is the two-way additive model:Y ijk =µ+α i +δ j +ε ijk .(11.7)The grand mean is µ, α i the mean <strong>for</strong> the ith level of x 1 , δ j is the mean <strong>for</strong> the ith level ofx2, and the error terms, ε ijk , are an i.i.d. sequence with a Normal(0,σ) distribution.Two common significance tests investigate whether the different levels of x 1 and x 2have an effect on the mean of Y. For the first variable, x 1, the hypotheses areThe equivalent one <strong>for</strong> x 2 replaces the α’s above with δ’s.■ Example 11.9: Driver differences in evaluating gas mileage An automotive website wishes to test the miles-per-gallon rating of a car. It has three drivers and two cars ofthe same type. Each driver is asked to drive each car three times and record the miles pergallon. Table 11.5 records the data. Ideally, there should be little variation. But is this thecase with the data?Table 11.5 Does the driver or car make adifference in mileage?Driver DriverCar a b c Car a b cA 33.3 34.5 37.4 B 32.6 33.4 36.633.4 34.8 36.8 32.5 33.7 37.032.9 33.8 37.6 33.0 33.9 36.711.4.1 Treatment coding <strong>for</strong> additive two-way ANOVABe<strong>for</strong>e analyzing this model, we incorporate it into our linear-model picture usingdummy variables. We follow the same coding (treatment coding) in terms of indicators asthe one-way case. Relabel the observations 1 through 18. Let be the indicator

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

Saved successfully!

Ooh no, something went wrong!