We can calculate the value of p Pr (> | t |) in the following ways:
tval <- 5.06 df <- 178
Below we show the same geometrically with a different (less extreme) value of t-statistics, as we see, there are two (symmetrical) blue areas that together represent the corresponding probability, for a two-sided t-test.
df <- 178 x <- seq(-6, 6,0.01) y <- dt(x, df) tval <- 1.25 plot(x, y, type='l', main='t-distribution and p-value (5% significance level, 2-sided t-test)') abline(h=0) abline(v = c(tval, -tval), col='red') index1 <- which(x >= -tval)[1] index2 <- which(x >= tval)[1] polygon(x = c(x[1:index1], x[index1], x[1]), y = c(y[1:index1], 0, 0), col = "blue") polygon(x = c(x[index2], x[index2], x[index2:length(x)]), y = c(0, y[index2], y[index2:length(y)]), col = "blue")

source share