简体   繁体   English

韦尔奇方差分析后进行特定成对比较的事后

[英]post hoc for specific pairwise comparisons after welch's anova

I am quite new to R and completely new to this website, so I really hope I am ably to convey my question in a clear way. 我对R相当陌生,对本网站还是陌生的,所以我真的希望我能以清晰的方式传达我的问题。

The following is a part of my data set: 以下是我的数据集的一部分:

A1<-c(0.308, 0.3624, 0.1861, 0.6176, 0.0506, 0.1014, 0.2245, 0.1894, 0.246, 0.1795)
A2<-c(0.0785, 0.1583, 0.1803, 0.0538, 0.0534, 0.0646, 0.0902, 0.0307, 0.2002, 0.1135, 0.0862)
B1<-c(0.293, 0.2159, 0.1919, 0.1904, 0.1274, 0.1482, 0.1579, 0.3284, 0.1948, 0.3159, 0.1764, 0.0403)
B2<-c(0.0741, 0.0601, 0.0273, 0.077, 0.1214, 0.0837, 0.0521, 0.0746, 0.0733, 0.0403, 0.0544)

the data is normally distributed but shows heteroscedasticity, so I used an ANOVA with Welch's correction after creating a dataframe: 数据是正态分布的,但显示出异方差性,因此在创建数据框后,我使用了带有Welch校正的ANOVA:

(X <- data.frame(Y = c(A1,A2,B1,B2), Group = rep(c("A1", "A2", "B1", "B2"), times = c(length(A1), length(A2), length(B1), length(B2)))))
oneway.test(Y ~ Group, data = X)

    One-way analysis of means (not assuming equal variances)

data:  Y and Group
F = 12.346, num df = 3.000, denom df = 19.002, p-value = 0.0001037

I then used a pairwise t-test with non-pooled standard deviations (because of the heteroscedasticity) for the post-hoc comparisons 然后,我将成对t检验与非合并标准差(由于异方差)一起用于事后比较

with(X, pairwise.t.test(Y, Group, pool.sd=FALSE))

    Pairwise comparisons using t tests with non-pooled SD 

data:  Y and Group 

   A1      A2      B1     
A2 0.05617 -       -      
B1 0.40115 0.01665 -      
B2 0.02360 0.17723 0.00089

P value adjustment method: holm 

My problem is that I am not really interested in all the comparisons, I really only want to compare A1 with A2, B1 with B2 and so on. 我的问题是我对所有比较都不感兴趣,我只想比较A1与A2,B1与B2,依此类推。 My data set also includes C1&2, D1&2 and E1&2 so I am loosing quite some significance through the p-value adjustment seeing that the t-test is run for 45 pairs. 我的数据集还包括C1&2,D1&2和E1&2,因此我看到p值调整用于45对,因此通过p值调整失去了相当大的意义。

I could of course just run each t-tests I am interested seperately via the t.test() function and adjusted the p-values manually. 我当然可以通过t.test()函数分别运行我感兴趣的每个t检验,并手动调整p值。 However, I will have a similar but larger data set soon, maiking this a very tedious job. 但是,我很快就会有一个类似但更大的数据集,这使这项工作非常繁琐。 So I was wondering if there is an option in R to choose which comparisons are included in the pairwise.t.test() , or if there is another post hoc option that makes this possible. 所以我想知道R中是否有一个选项来选择pairwise.t.test()中包括哪些比较,或者是否有另一个事后选项使之成为可能。

Any advice would be greatly appreciated. 任何建议将不胜感激。

Here's a quick way 这是一个快速的方法

Z <- split(X, substr(X$G, 1, 1))   # split your data frame into a list of data frames 
ans <- lapply(Z, function(A) with(A, pairwise.t.test(Y, Group, pool.sd=FALSE)))

Output 输出量

A list of your desired pairwise comparisons ($A group, $B group) 所需的成对比较列表($ A组,$ B组)

$A
        Pairwise comparisons using t tests with non-pooled SD 
data:  Y and Group 

   A1   
A2 0.019

P value adjustment method: holm 

$B
        Pairwise comparisons using t tests with non-pooled SD 
data:  Y and Group 

   B1     
B2 0.00015

P value adjustment method: holm 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM