Skip to content

Instantly share code, notes, and snippets.

@HeenaR17
Created March 23, 2021 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HeenaR17/905b2794fc739189c64a70043c41c9f3 to your computer and use it in GitHub Desktop.
Save HeenaR17/905b2794fc739189c64a70043c41c9f3 to your computer and use it in GitHub Desktop.
#Creating poisson distribution for ages of students in the school (population) and one particular class (sample)
import scipy.stats as stats
import pandas as pd
import math
school=stats.poisson.rvs(loc=18,mu=35,size=1500)
classA=stats.poisson.rvs(loc=18,mu=30,size=60)
ttest,p_value=ttest_1samp(classA,popmean=school.mean())
if p_value >= 0.5:
print("Accept null hypothesis")
else:
print("Reject null hypothesis")
# Output: Reject null hypothesis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment