This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy.stats as stats | |
import math | |
def one_sample_ztest_pop_proportion(tail, p, pbar, n, alpha): | |
#Calculate test stat | |
sigma = math.sqrt((p*(1-p))/(n)) | |
z = round((pbar - p) / sigma, 2) | |
if tail == 'lower': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scipy.stats as stats | |
import math | |
def one_sample_ttest_pval(tail, mu, x, s, n, alpha): | |
#Calculate test statistic and p-value. Provide summary stats and specify 1 or 2 tailed test | |
t = round((x - mu) / (s / math.sqrt(n)),2) | |
test_stat = round(stats.t.ppf(q=alpha, | |
df=n-1),3) | |
if tail == 1: |