- Login, find course Web page, run S-PLUS
- Use the Commands Window to execute commands
- Load data sets

- use S-PLUS for analysis of variance
- complete an ANOVA table by hand
- interpret an ANOVA table
- count degrees of freedom
- find p-values from an F table

- understand when a one-way ANOVA is appropriate
- know the assumptions in an ANOVA

- Populations are
**normal**. - The populations have
**equal variances**. - The samples are
**independent**.

ANOVA is robust to lack of normality in the populations if the sample sizes are large or if the populations are not strongly skewed. The only concern is small skewed samples. The assumption of equal variances is equivalent to an assumption made when comparing two population means with independent samples. ANOVA is robust to lack of equal variance (heteroskedacticity) as long as the sample standard deviations are about the same order of magnitude. If the ratio of the largest sample sd to the smallest is more than ten or so, you need to do something more advanced to account for the heteroskedacticity. The last assumption says that ANOVA is not appropriate for paired or matched samples, foe example.

SS_Among = sum n_i * (xbar_i - grand_mean)^2 SS_Within = sum (n_i - 1) * (s_i)^2 df_Among = (number of groups) - 1 df_Within = sum (n_i - 1) = (total number of measurements) - (number of groups) MS_Among = SS_Among / df_Among MS_Within = SS_Within / df_Within F = MS_Among / MS_Within

The p-value is the area to the right of the test statistic under an F distribution.

The basic structure of the two methods is the same. The simultaneous confidence intervals are of this form.

(difference in sample means) +/- (multiplier)(standard error)

where the standard error has the form

(pooled estimate of sigma)*sqrt(1/(sample size 1) + 1/(sample size 2))

For the Scheffe method, the multiplier comes from an F distribution, specifically

multiplier = sqrt( (g-1)*F(1-alpha) )where F(1-alpha) is the point that cuts off the upper right tail area of alpha from an F distribution with (g-1) and (N-g) degrees of freedom.

For the Bonferroni method, the multiplier is the value t so that the area between -t and t is 1 - alpha/k from a t distribution with (N-g) degrees of freedom where k is the number of comparisons.

- Load in the data from exercise 9-1.
- Use S-PLUS to do an analysis of variance
with the Scheffe method for multiple comparisons.
- Select Statistics:ANOVA:Fixed Effects...
- On the Model tab, click on hours as the dependent variable and treatment as the independent variable.
- For the Results tab, click on Means (along with the defaults).
- For the Plot tab, click on Residuals versus Fit and change Number of Extreme Points To Identify from 3 to 0.
- On the Compare tab, select temperature for Levels Of, click on Plot Intervals, and select Scheffe for Method.
- Click on the Apply Button.
- Close the warning message box that appears.

- Change the method for multiple comparisons to Bonferroni and click on OK, and examine the output.

If time permits, you can complete the ANOVA table from the formulae using a hand calculator. You may wish to use S-PLUS to find sample means and variances.

- Use S-PLUS to find the mean and sample variance from each sample as well as the mean and sample variance of the data treated as one large sample.
- Fill in a one-way ANOVA table as on page 238 for your data.
Source SS df MS F

Among Within

Total - Find the exact p-value by calculating the area to the right of your F test statistic.
Something like the example below will do the trick.
(You will get a different test statistic.)
> 1-pf(22.42,2,12)

- Construct side-by-side boxplots of count versus mouse. In this informal analysis, does it appear that the count depends on the mouse? Do the boxplots show skewed or fairly symmetric distributions?
- Use S-PLUS to carry out a one-way ANOVA for this data using count as the response. Complete the table. What is the F statistic and the p-value?
- If you have a very small p-value, is it reasonable to conclude that the effects of the treatment are not the same for each mouse?

Last modified: November 27 2000

Bret Larget, larget@mathcs.duq.edu