# -*- coding: utf-8 -*-
"""
Created on Wed Jan  5 11:11:17 2022

@author: Sim
"""

import scipy.stats as st
import statsmodels.stats.proportion as stp

ctab = [[50, 45], [150, 160]]
chi2v, pval, df, expd = st.chi2_contingency(ctab, correction=False)
print(chi2v, pval, df, expd)

#-----------A 선호 비율차
res1 = stp.test_proportions_2indep(50, 95, 150, 310)
print(res1)
#-----------B 선호 비율차
res2 = stp.test_proportions_2indep(45, 95, 160, 310)
print(res2.statistic, res2.pvalue)

