トップ 履歴 一覧 Farm ソース 検索 ヘルプ PDF RSS ログイン

interaction.plot

*disclaimer
603062

R

interaction.plot() 交互作用の図を描く

  • パッケージなしで標準で組み込まれている。
> ?interaction.plot

interaction.plot {stats}	R Documentation
Two-way Interaction Plot
Description
Plots the mean (or other summary) of the response for two-way combinations of factors, thereby illustrating possible interactions.

Usage
interaction.plot(x.factor, trace.factor, response, fun = mean,
                 type = c("l", "p", "b", "o", "c"), legend = TRUE,
                 trace.label = deparse1(substitute(trace.factor)),
                 fixed = FALSE,
                 xlab = deparse1(substitute(x.factor)),
                 ylab = ylabel,
                 ylim = range(cells, na.rm = TRUE),
                 lty = nc:1, col = 1, pch = c(1:9, 0, letters),
                 xpd = NULL, leg.bg = par("bg"), leg.bty = "n",
                 xtick = FALSE, xaxt = par("xaxt"), axes = TRUE,
                 ...)

 使い方

  • モデル式ではなく、もとのデータフレームから、計算して図を描く

基本はこの三つ

  • x.factor=データ$横軸に並べる要因
  • trace.factor=データ$図を描く要因
  • response=データ$縦軸に並べる応答変数

interaction.plot(x.factor=both13.dat$year, trace.factor=both13.dat$mode, response=both13.dat$IPSyn13)