-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added file on chisquare_test #5890
Conversation
minor fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing to Codecademy Docs @Neema-Joju 😄
The entry looks good for a second round of review! 🚀
Hi @mamtawardhani |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Neema-Joju, I've suggested some changes; please make them as soon as possible. Thank you!!
content/python/concepts/statsmodels/terms/chi-squared-tests/chi-squared-tests.md
Show resolved
Hide resolved
content/python/concepts/statsmodels/terms/chi-squared-tests/chi-squared-tests.md
Outdated
Show resolved
Hide resolved
from statsmodels.stats.proportion import proportions_chisquare | ||
|
||
# Observed counts | ||
counts = [150, 80, 100, 70] | ||
|
||
# Total number of observations | ||
nobs = sum(counts) | ||
|
||
# Perform the chi-square test | ||
chi2, p_value, expected_table = proportions_chisquare(counts, nobs) | ||
|
||
# Print the results | ||
print(f"Chi-square statistic: {chi2}") | ||
print(f"P-value: {p_value}") | ||
print("\nExpected Counts:") | ||
print(expected_table) | ||
|
||
# Interpret the p-value | ||
alpha = 0.05 | ||
if p_value < alpha: | ||
print("\nReject the null hypothesis: The proportions are significantly different.") | ||
else: | ||
print("\nFail to reject the null hypothesis: The proportions are not significantly different.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the syntax, you used the scipy.stats.chisquare
function, but here you are using statsmodels.stats.proportion.proportions_chisquare
; both are two different approaches, and It can confuse the viewer. Can you add the syntax of this(statsmodels.stats.proportion.proportions_chisquare
) method in the syntax section above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
👋 @Neema-Joju 🎉 Your contribution(s) can be seen here: https://www.codecademy.com/resources/docs/python/statsmodels/chi-squared-tests Please note it may take a little while for changes to become visible. |
Description
Added a new file entry on chi-square test. Improving documentation and providing more context for the users to understand.
Issue Solved
#5689
Type of Change
Checklist
main
branch.Issues Solved
section.