首页 > 解决方案 > 比较具有多个变量的两组

问题描述

我试图从多个变量(行为)中比较两组(高密度与低密度)之间的平均值。我试图检验这样一个假设,即当密度变化时,活动的总持续时间不会改变。

我已经尝试了几个 t.tests 和ANOVASR,但我认为我的统计知识与 Rstudio 中的编码混合在一起,使我无法准确地看到我应该在每一行代码中添加什么。

    Who      Activity Duration Visitor_Density
1    Ch    Stationary       14            High
2    Co    Stationary       18            Low
3    Co   Interaction        2            Low
4    R    Stationary        6            High
5    Ch   Interaction        1            High
6    J       Display       10            High
7    Ch   Interaction        6            High

t.test(chimp2$Visitor_Density == "High", chimp2$Visitor_Density == "Low", mu=0, paired = TRUE, conf.level = 0.95)

输出:

Paired t-test

data:  chimp2$Visitor_Density == "High" and chimp2$Visitor_Density == "Low"
t = 3.9875, df = 1177, p-value = 7.09e-05
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.05864408 0.17225575
sample estimates:
mean of the differences 
              0.1154499

在我看来,上面的代码是错误的,至少我根本没有考虑到不同的活动。我应该为此使用ANOVA吗?任何帮助都感激不尽!

标签: rstatistics

解决方案


推荐阅读