从成对测试中提取t值 [英] extracting t value out of pairwise.t.test

查看:99
本文介绍了从成对测试中提取t值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以从pairwise.t.test函数中提取t值,因为它仅报告p值. 在运行重复测量的方差分析后,我使用pairwise.t.test()进行了多次比较,该方差分析报告了明显的主要效果.

I would like to know if I could extract t values out of the pairwise.t.test function since it is only reporting the p values. I used the pairwise.t.test() for multiple comparisons after running a repeated-measures anova which reported a significant main effect.

非常感谢您!

推荐答案

尝试找出类似的东西时,可以尝试一些简单的方法(当然,不能保证它们可以在任何给定的实例中运行) .尝试做的第一件事是查看文档(?pairwise.t.test),然后查看Value下列出的内容.在这种情况下,它只会显示:

There are some simple things to try when trying to figure something like this out (there is, of course, no guarantee that they will work in any given instance). The first thing to try is to look at the documentation (?pairwise.t.test) and see what's listed under Value. In this case it only says:

"pairwise.htest"类的对象

Object of class "pairwise.htest"

要尝试的第二件事是获取示例对象并将其分配给变量,然后可以运行str(obj).以下使用文档中的示例:

The second thing to try is to get an example object and assign it to a variable, then you can run str(obj). The following uses the example from the documentation:

attach(airquality)
Month <- factor(Month, labels = month.abb[5:9])
obj <- pairwise.t.test(Ozone, Month)
str(obj)
List of 4
 $ method         : chr "t tests with pooled SD"
 $ data.name      : chr "Ozone and Month"
 $ p.value        : num [1:4, 1:4] 1 0.000264 0.000195 1 NA ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:4] "Jun" "Jul" "Aug" "Sep"
  .. ..$ : chr [1:4] "May" "Jun" "Jul" "Aug"
 $ p.adjust.method: chr "holm"
 - attr(*, "class")= chr "pairwise.htest"

不幸的是,这并没有显示我们想要看到的内容(例如,类似$ t.stat之类的东西).

Unfortunately, that doesn't show what we'd like to see (e.g., something like $ t.stat).

您的最后一个选择是查看代码.您可以通过在命令提示符下键入不带括号的函数调用来获得它:

Your last option is to look at the code. You can get it by typing the function call without parentheses at the command prompt:

> pairwise.t.test
function (x, g, p.adjust.method = p.adjust.methods, pool.sd = !paired, 
    paired = FALSE, alternative = c("two.sided", "less", "greater"), 
    ...) 
{
    <code omitted>
    if (pool.sd) {
        <code omitted>
        }
    }
    else {
        <code omitted>
        compare.levels <- function(i, j) {
            xi <- x[as.integer(g) == i]
            xj <- x[as.integer(g) == j]
            t.test(xi, xj, paired = paired, alternative = alternative, 
                ...)$p.value
        }
    }
    PVAL <- pairwise.table(compare.levels, levels(g), p.adjust.method)
    ans <- list(method = METHOD, data.name = DNAME, p.value = PVAL, 
        p.adjust.method = p.adjust.method)
    class(ans) <- "pairwise.htest"
    ans
}

关键部分是定义的函数compare.levels,该函数仅保留基础t检验的p值.因此,您问题的直接答案是,您无法提取t统计量.

The key portion is the defined function compare.levels, which is only retaining the p-value from the underlying t-test. Thus, the straight answer to your question is no, you can't extract t-statistics.

这篇关于从成对测试中提取t值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆