9.2 车间生产滚珠
某车间生产滚珠,随机的抽出了50粒,测得他们的直径为(单位mm)15.0 15.8 15.2 15.1 15.9 14.7 14.8 15.5 15.6 15.3 15.1 15.3 15.0 15.6 15.7 14.8 14.5 14.2 14.9 14.9 15.2 15.0 15.3 15.6 15.1 14.9 14.2 14.6 15.8 15.2 15.9 15.2 15.0 14.9 14.8 14.5 15.1 15.5 15.5 15.1 15.1 15.0 15.3 14.7 14.5 15.5 15.0 14.7 14.6 14.2 通过计算得到样本均值为15.0780,样本标准差为0.4325,试问滚珠直径是否服从正态分布N(15.0780,0.4325^2)(α=0.05)?
import numpy as np
from scipy.stats import shapiro
data = [15.0, 15.8, 15.2, 15.1, 15.9, 14.7, 14.8, 15.5, 15.6, 15.3,
15.1, 15.3, 15.0, 15.6, 15.7, 14.8, 14.5, 14.2, 14.9, 14.9,
15.2, 15.0, 15.3, 15.6, 15.1, 14.9, 14.2, 14.6, 15.8, 15.2,
15.9, 15.2, 15.0, 14.9, 14.8, 14.5, 15.1, 15.5, 15.5, 15.1,
15.1, 15.0, 15.3, 14.7, 14.5, 15.5, 15.0, 14.7, 14.6, 14.2]
stat, p = shapiro(data)
print(f"Shapiro-Wilk Statistic: {stat}")
print(f"P-value: {p}")
alpha = 0.05
if p > alpha:
print("滚珠直径数据服从正态分布N(15.0780, 0.4325^2)。")
else:
print("滚珠直径数据不服从正态分布N(15.0780, 0.4325^2)。")
print("学号后两位为:04")