YKhmelnitskiy / intro-data-capstone-musclehub

0 stars 0 forks source link

Incorrect pval - error when inputting contingency table #4

Open driskerr opened 5 years ago

driskerr commented 5 years ago

https://github.com/jewgeney/intro-data-capstone-musclehub/blob/163399689a37b3ba7ecfc7b955f8ea20bfe90f0d/MuscleHub%20capstone%20project/musclehub.py#L264-L265

When I run this as written, I get that 'pval' is = 1.0, which is incorrect. The issue is that you are not passing the contingency table as a table (which is a list of lists) [[],[]], but as two separate values [],[]

When I add the extra brackets around the frequencies, I get the correct answer:

chi2,pval,dof,expected = chi2_contingency([[250,2254],[325,2175]])
print(pval)

>> 0.0009647827600722304

YKhmelnitskiy commented 5 years ago

ahhhhh that makes sense now!!! Thank you