#
Statistics 5601 (Geyer, Spring 2006) Examples: Two-Way Layout

## Contents

To do each example, just click the "Submit" button.
You do not have to type in any R instructions or specify a dataset.
That's already done for you.

### Example 7.1 in Hollander and Wolfe.

### Summary

- Friedman test for randomized complete block data
- P = 0.0038

- two-way ANOVA test for randomized complete block data
- P = 0.0041

### Comments

**Note:** In the `friedman.test`

function call the
"groups" variable goes in front of the vertical bar and the "blocks"
variable goes behind the vertical bar. We are looking for a "method"
effect here so `method`

goes in front of the bar.

The second analysis done by the `aov`

function is the
usual parametric procedure: two-way ANOVA. It produces
`P` = 0.004084 for comparison with the Friedman `P`-value.

The first line tells R that `player`

is to be treated as
a factor

, that is, as a non-numerical variable. If it were
omitted, the ANOVA would be nonsense. For some
reason `friedman.test`

comes out the same if it is omitted.

We don't also have to tell R that `method`

is a factor,
because it automatically treats any non-numerical variable as a factor.
If method had been designated by numerical codes, we would also need
a statement like the first line for `method`

.

If R were consistent, these two analyses would have similar syntax,
but it isn't and they don't.

**Warning:** Do not omit the lines converting the categorical
variables to R `factor`

objects. At least don't omit them unless
you are sure it won't make a difference.