运行 ❯
获取您
自己的 Python
服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
import scipy.stats as stats import math # Specify the sample mean (x_bar), the sample standard deviation (s), the mean claimed in the null-hypothesis (mu_null), and the sample size (n) x_bar = 62.1 s = 13.46 mu_null = 55 n = 30 # Calculate the test statistic test_stat = (x_bar - mu_null)/(s/math.sqrt(n)) # Output the p-value of the test statistic (right tailed test) print(1-stats.t.cdf(test_stat, n-1))
0.0036182783769481697