Chi2 Stats

Ok so I’m on the section Expected Contingency Tables the code for this part is interesting the code is:

chi2, pval, dof, expected = chi2_contingency(special_authority_freq)

However in the instructions it tells you “calculate the expected contingency table if there’s no association and save it as expected”

but isn’t this code to figure out if there’s an association? On top of that if I save it as expected like this

expected = chi2_contingency(special_authority_freq)

I get an error but if I write it like the previous example its fine and I can print expected or chi2 or dof and get different answers.

So my question is what am I suppose to save as expected? I assume that chi_contingency() is just a function that returns different outputs to the 4 variables chi2, pval, dof, and expected

Can you please post a link to the lesson for reference?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.