计算95%置信区间

计算95%置信区间

import numpy as np
from scipy import stats
 
valueList = [60.33,59.13,60.33]
 
    
n = len(valueList)
averageValue = np.mean(valueList)
print("样本均值为:", averageValue)
standardError = np.std(valueList,ddof = 1)
print("样本标准误差为:", standardError)
 
a = averageValue - 1.96 * standardError / math.sqrt(n)
b = averageValue + 1.96 * standardError / math.sqrt(n)
print("区间估计值:[", a, ",", b, "]")
print(1.96 * standardError / math.sqrt(n))

你可能感兴趣的:(python)