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

查看:70
本文介绍了从pairwise.t.test 中提取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-test 的 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.

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

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