Description Usage Arguments Details Value Examples

Plots either the fitted values and residuals under additivity or a diagnostic plot for removable non-additivity by a power transformation

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
## S3 method for class 'twoway'
plot(x, which = c("fit", "diagnose"), ...,
na.rm=any(is.na(x$residuals)))
## S3 method for class 'twoway.fit'
plot(x, main = paste0("Tukey two-way fit plot for ",
x$name, " (method: ", x$method, ")"), xlab = expression(hat(mu) *
" + Column Effect - Row Effect"), ylab = expression("Fit = " * hat(mu)
* " + Column Effect + Row Effect"), rfactor = 1, rcolor = c("blue",
"red"), lwd = 3, ylim = NULL, ...,
na.rm=any(is.na(x$residuals)))
## S3 method for class 'twoway.diagnose'
plot(x, annotate = TRUE, jitter = FALSE,
smooth = FALSE, pch = 16, ...)
``` |

`x` |
a |

`which` |
one of |

`...` |
other arguments, passed to |

`na.rm` |
logical. Should missing values be removed? |

`main` |
plot title |

`xlab` |
X axis label |

`ylab` |
Y axis label |

`rfactor` |
draw lines for |

`rcolor` |
a vector of length 2 giving the color of lines for positive and negative residuals |

`lwd` |
line width for residual lines in the fit plot |

`ylim` |
Y axis limits |

`annotate` |
A logical value; if |

`jitter` |
A logical value; if |

`smooth` |
A logical value; if |

`pch` |
Plot character for point symbols in the diagnostic plot |

For the `which="fit"`

plot, the basic result comes from a plot of the row effects against the column fitted
values, which appears as a rectangular grid in these coordinates. Rotating this 45 degrees counterclockwise give a plot
in which the vertical coordinate is the fitted value for the two-way table, and the horizontal coordinate is the column fit
minus the row effect. The spacing of the grid lines for the rows and columns of the table show the relative magnitudes of the
row/column means or medians.

For the `which="diagnose"`

plot, the interaction residuals from an additive model, *y_{ij} = μ + α_i + β_j*,
are plotted against the estimated components *α_i β_j / μ*. If this plot shows a substantially non-zero
slope, *b*, this analysis suggests that a power transformation, * y \rightarrow y^(1-b)* might reduce the
apparent interaction effects.

For both plots, if you want to directly compare the result of `method="mean"`

and `method="median"`

, it is
essential to set the same `xlim`

and `ylim`

axes in the call.

The diagnostic plot invisibly returns a list with elements `c("slope", "power")`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
data(taskRT)
tw <- twoway(taskRT)
tw
twmed <- twoway(taskRT, method="median")
twmed
plot(tw, xlim=c(2,7), ylim=c(2,7)) ## use the same xlim and ylim, for comparison
plot(twmed, xlim=c(2,7), ylim=c(2,7))
plot(tw, which="diagnose", xlim=c(-.19, .19), ylim=c(-.5, .55))
plot(twmed, which="diagnose", xlim=c(-.19, .19), ylim=c(-.5, .55))
data(insectCounts)
twi <- twoway(insectCounts)
twimed <- twoway(insectCounts, method="median")
plot(twi, xlim=c(-250, 700), ylim=c(-180, 900))
plot(twimed, xlim=c(-250, 700), ylim=c(-180, 900))
plot(twi, which="diagnose", xlim=c(-160, 170), ylim=c(-200, 400)) ## power = .1
plot(twimed, which="diagnose", xlim=c(-160, 170), ylim=c(-200, 400)) ## power = .3
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.