[英]getting p-values for a pairwise correlation (dplyr)
I am using the code below to get correlations between my dependent variable and a questionnaire response (for different levels of different conditions).我正在使用下面的代码来获取我的因变量和问卷响应之间的相关性(针对不同条件的不同级别)。
BREAK %>%
group_by(condition, valence) %>%
summarize(COR=cor(rt, positive_focused_cognitiveER)) %>%
ungroup()
It gives me the correlations and their directions (+/-).它给了我相关性及其方向(+/-)。 I would like to know, however, if those correlations are significant.
但是,我想知道这些相关性是否显着。 Is there a way to simply add a line to the code I already have to get the p-values?
有没有办法简单地在我已经必须获取 p 值的代码中添加一行? Or another easy code?
或者另一个简单的代码? (I don't need fancy stuff, just the numbers)
(我不需要花哨的东西,只需要数字)
The only fitting post I found for my problem was this one Getting p values for groupwise correlation using the dplyr package but the answer did not help me.我为我的问题找到的唯一合适的帖子是这个使用 dplyr package 获得分组相关的 p 值,但答案对我没有帮助。
Thanks in advance for any tips: :)在此先感谢您的任何提示::)
You can compute p-values with stats::cor.test
:您可以使用
stats::cor.test
计算 p 值:
BREAK %>%
group_by(condition, valence) %>%
summarize(COR = stats::cor.test(rt, positive_focused_cognitiveER)$estimate,
pval = stats::cor.test(rt, positive_focused_cognitiveER)$p.value
) %>%
ungroup()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.