Python – Performing t-test of estimate with standard error


I’m wondering if there is a way to perform a two-tailed t-test for an estimate, given its standard error and the number of degrees of freedom? The estimate is read from another software. I have been using the t.dist.2t(abs(estimate/SE), df) in Excel, but having it directly in Python would be a huge help….

Asked By: branwen85



Just in case anyone is looking for a solution, I have been provided with one by my colleague

import scipy.stats as stats
import numpy as np


pval = stats.t.sf(np.abs(est/se),df)*2
Answered By: branwen85