Skip to content

Instantly share code, notes, and snippets.

@SaraM92
Created September 29, 2020 21:18
Show Gist options
  • Save SaraM92/fa100c6395898d321a0728f804882171 to your computer and use it in GitHub Desktop.
Save SaraM92/fa100c6395898d321a0728f804882171 to your computer and use it in GitHub Desktop.
#import needed libraries
import statsmodels.api as sm
import numpy as np
import matplotlib.pyplot as plt
#set hypothesis parameters
n = 1018
pnull = .52
phat = .56
#apply z test
sm.stats.proportions_ztest(phat * n, n, pnull, alternative='larger')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment