News

New paper!

Tuesday, May 31, 2022

Statistics - Calculate exact p-value from t-statistic in a simple regression in Python

How to find a P-value from a t-score in Python

two-tailed test (use this for a regression, see below)
script.stats.t.sf(abs(t), df) * 2
    t: t-statistic
    df: n-k
    k: the total number of independent variables = # explanatory variables + 1 (for target variable).
    n: the number of observations

one-tailed test
script.stats.t.sf(abs(t), df)
    t: t-statistic
    df: n-k