print('Hello world!')
import numpy as np
from scipy import stats
# 表1のデータ
data = [154.2, 150.4, 149.3, 164.2, 161.0, 164.2, 163.1, 140.5, 163.0, 158.2]
# 標本平均の計算
sample_mean = np.mean(data)
# 標本標準偏差の計算
sample_std = np.std(data, ddof=1)
# 標準誤差の計算
standard_error = sample_std / np.sqrt(len(data))
# 不偏標本分散の計算
sample_variance = np.var(data, ddof=1)
# 95%信頼区間の計算
confidence_interval = stats.t.interval(0.95, len(data) - 1, loc=sample_mean, scale=standard_error)
# 結果の表示
print(f"標本平均: {sample_mean:.3f}")
print(f"不偏標本分散: {sample_variance:.3f}")
print(f"t分布の自由度: {len(data)-1}")
print(f"95%信頼区間: ({confidence_interval[0]:.3f}, {confidence_interval[1]:.3f})")
To embed this project on your website, copy the following code and paste it into your website's HTML: