首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用get_contrast获得边际均值

如何使用get_contrast获得边际均值
EN

Stack Overflow用户
提问于 2019-09-13 22:10:54
回答 1查看 157关注 0票数 1

我想使用psycho包中的get_contrasts()函数来获得组的平均值。

psycho blog (https://neuropsychology.github.io/psycho.R/2018/05/01/repeated_measure_anovas.html)中,他们展示了如何通过get_contrast获得组之间的差异。但我无法获得组之间的边际均值,因为它们显示(见下图)。

我三次

代码语言:javascript
复制
# same results betwen them
get_contrasts(fit, "Emotion_Condition")
get_contrasts(fit)

# quite obvious it wont work, but at least I tired
get_contrasts(fit, "Emotion_Condition*Subjective_Valence")

# print results 
print(results$contrasts) # only show two levels of factors
print (results) # remove `contrasts` and  show the same outcome as they do
代码语言:javascript
复制
# Here are the codes that they provide

library(psycho)
library(tidyverse)

df <- psycho::emotion %>% 
  select(Participant_ID, 
         Participant_Sex, 
         Emotion_Condition, 
         Subjective_Valence,
         Recall)

library(lmerTest)
fit <- lmer(Subjective_Valence ~ Emotion_Condition + (1|Participant_ID), data=df)
anova(fit)

results <- get_contrasts(fit, "Emotion_Condition")
print(results$contrasts)

# ERRORs! since I cant find the means (mrginal means between groups). it is not possible to plot. 
# How can I get means from results here?

ggplot(results$means, aes(x=Emotion_Condition, y=Mean, group=1)) +
  geom_line() +
  geom_pointrange(aes(ymin=CI_lower, ymax=CI_higher)) +
  ylab("Subjective Valence") +
  xlab("Emotion Condition") +
  theme_bw()

如果有人能帮助我,我将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2019-11-27 23:53:34

使用get_means得到估计的边际均值。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57925260

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档