How are p-values in fittings estimated?

I am trying to understand how p-values retrieved in a ParameterTable estimated but I couldn't find any specific information in the documentation about this. For instance, considering

data = {{0, 1}, {1, 0}, {3, 2}, {5, 4}};
lm = LinearModelFit[data, x, x];
lm["ParameterTable"]


How is the p-value of x computed? This answer explains why the p-value should be accepted/rejected and what it means. But my question is related with how it is actually computed?

1 Answer

In this particular example the P-values can be found with the following:

2 (1 - CDF[StudentTDistribution[2], 0.268373])
2 (1 - CDF[StudentTDistribution[2], 2.95892])


The "2" in StudentTDistribution[2] is the degrees of freedom calculated from the sample size (4) minus the number of parameters estimated (2).

In this case the P-value is the probability of observing a more extreme t-Statistic given that the associated parameter is actually 0. This is the probability that the observed t-Statistics under repeated sampling when the true parameter is zero could be larger than 0.26873 or less than -0.26873 (i.e., a two-tailed test).