如何在线性回归中手动计算t统计量的p值 [英] How to manually compute the p-value of t-statistic in linear regression

查看:98
本文介绍了如何在线性回归中手动计算t统计量的p值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对具有178个自由度的两尾t检验进行了线性回归. summary 函数为我的两个t值提供了两个p值.

I did a linear regression for a two tailed t-test with 178 degrees of freedom. The summary function gives me two p-values for my two t-values.

t value Pr(>|t|)
5.06    1.04e-06 ***
10.09    < 2e-16 ***
...
...
F-statistic: 101.8 on 1 and 178 DF, p-value: < 2.2e-16

我要使用以下公式手动计算t值的p值:

I want to calculate manually the p-value of the t-values with this formula:

p = 1 - 2*F(|t|)

p_value_1 <- 1 - 2 * pt(abs(t_1), 178)
p_value_2 <- 1 - 2 * pt(abs(t_2), 178)

我没有获得与模型摘要中相同的p值.因此,我想知道 summary 函数 Pr(> | t |)与我的公式有何不同,因为我找不到Pr(> | t |).

I don't get the same p-values as in the model summary. Therefore, I want to know how the summary function Pr(>|t|) is different from my formula, as I can't find the definition of Pr(>|t|).

你能帮我吗?非常感谢!

Can you help me? Thanks a lot!

推荐答案

2 * pt(-abs(t_value), df)

例如:

2 * pt(-5.06, 178)
#[1] 1.038543e-06

2 * pt(-10.09, 178)
#[1] 3.223683e-19


或者,使用


Alternatively, use

2 * pt(abs(t_value), df, lower.tail = FALSE)

这篇关于如何在线性回归中手动计算t统计量的p值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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