Search code examples
pythonstatisticsstandard-errort-test

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....


Solution

  • 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
    
    est=0.0044
    se=0.0826
    df=767
    
    pval = stats.t.sf(np.abs(est/se),df)*2