[Statistics] 자주 쓰는 코드 정리

dauuuum·2021년 5월 24일

Statistics

목록 보기
4/5
post-thumbnail

1. T-test

from scipy import stats
pv1 = stats.ttest_1samp(tree, 400) #One-Sample T-test
pv2 = stats.ttest_ind(neuti_tree, cherry_tree).pvalue #Two-Sample T-test

2. Chi-squared test

from scipy.stats import chisquare
from scipy.stats import chi2_contingency

print(chisquare(obs, axis=None)) # One sample chi-square

print(chi2_contingency(obs2, correction = False)) 
print(chi2_contingency(obs2, correction = True))#2 Sample chi-square

🔎 # 결과해석
# 1 : $\chi^2$ statistic 
# 2 : p-value 
# 3 : degree of freedom 
# 4 : expected value for Observed

3. F-statistic

from scipy.stats import f_oneway
f_oneway(g1, g2, g3)

0개의 댓글