全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1421 1
2014-12-16
各位大神好:
我的数据形式是这样的
   subject treatment frame sf_result
1        1      cath  gain     8.125
2        1      cath  loss    10.000
3        3      sham  gain    31.875
4        3      sham  loss    27.500
5        5      cath  gain    -5.000
6        5      cath  loss   -10.000
7        6      sham  gain     7.500
8        6      sham  loss    18.125
9        8      sham  gain    -4.375
10       8      sham  loss   -13.125
11       9      cath  gain    12.375
12       9      cath  loss     7.500

最后一列是因变量, frame 和 treatment是自变量 , 如果我想做交互作用的示意图 ,怎么写代码 ?就是x轴是 gain 和 loss ,  y轴是result  ,两条线分别代表cath 和sham   。

thanks!!!!!!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-1-15 21:40:03
如果要做的话,在公式里面写出来就可以了。A*B表示因素A和B还有它们的交互作用都包括在分析里,如果要单独写出来交互作用要用A:B。
  
如果要画出来的话,interaction.plot()可以作出交互效应图,考查因素之间交互作用是否存在, 比如
  
> op<-par(mfrow=c(1, 2))
> plot(Time~Toxicant+Cure, data=rats)
> with(rats, interaction.plot(Toxicant, Cure, Time, trace.label="Cure"))
> with(rats,interaction.plot(Cure, Toxicant, Time, trace.label="Toxicant"))
  
说明是:
Use box plots and line plots to visualize group differences. There are also two functions specifically designed for visualizing mean differences in ANOVA layouts. interaction.plot( ) in the base stats package produces plots for two-way interactions.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群