简体   繁体   中英

Why scipy and Excel generate slightly different p-value for two-sample t-test?

For python , it is two-side test by default:

from scipy import stats
import numpy as np
wt = np.array([71.93636,71.34689,72.2162])
mut = np.array([71.58995,70.82698,70.89562])
t, p = stats.ttest_ind(wt, mut, equal_var=False)
print(t,p)

I got

2.06163943002 0.108425721876

In Excel , Data tab - Data Analysis - t-Test: Two-Sample Assuming Unequal Variances , I got same value for t , but slightly different value for p (0.1084... vs 0.1082...)

Can I ask why?

在此处输入图片说明

If you use

from scipy import stats
stats.ttest_rel(wt,mut)

it should match the same calculations in Excel.

rel is for related samples and ind is for independent samples.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM