||
老师,我想问一下做单因素方差分析的多重比较的时候如何获取每次比较的effect sizes和confidence intervals呀?
# 示例数据
set.seed(123)
data <- data.frame(
group = rep(c("A", "B", "C", "D"), each = 10),
response = c(rnorm(10, 5, 1), rnorm(10, 6, 1), rnorm(10, 7, 1), rnorm(10, 8, 1))
)
# 运行单因素ANOVA
anova_model <- aov(response ~ group, data = data)
summary(anova_model)
library(emmeans)
# 计算边际均值
emm <- emmeans(anova_model, ~ group)
# Tukey多重比较
tukey_results <- pairs(emm, adjust = "tukey")
# 查看多重比较结果
tukey_results
library(effectsize)
# 计算每个组之间比较的效应量
effect_sizes <- eff_size(emm, sigma = sigma(anova_model), edf = df.residual(anova_model))
# 查看结果
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-22 17:00
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社