ITPub博客

首页 > IT职业 > IT生活 > Chi-square 用途4

Chi-square 用途4

IT生活 作者:local0 时间:2021-09-09 10:08:34 0 删除 编辑

Data Science Day 6:

Chi-square application 3:

Test for Homogeneity of One Categorical Variable across serveral sample spaces.

We use theChi-square test for Homogeneityto evaluate if one single categorical variable has a similar distribution (or frequency proportion)across two or more sample spaces (or populations).

Example: 

Couple make-up companies wish to determine if there are differences in the sales market for China, USA, and Spain.

Customers China USA Spain

Buy 10000 2000 1000

Not Buy2013 391 212

H0(Null Hypotheses):The sales market has thesame distribution(frequency proportion) in China, USA, and Spain.

Solution:
we will useSciPypackage andchi2_contingencyfunction in Python.

Python Code:

country_buyer=np.array([[10000,2013],[2000,391],[1000,212]])
stats.chi2_contingency(country_buyer)

Result:

We havep-value= 0.69, so weacceptthe Null Hypotheses and conclude the Make up customerdistribution is the samein China, USA and Spain.

Data visualization:

We can see from the graph, the makeup customer has a similar distribution for China, USA, and Spain. It consolidated our statistical results.

图片描述

Code:

图片描述


I think it is human nature to pursue beauty and a decent amount of makeup does help men/women to level up our confidence, but I always remind myself don't be obsessed with external beauty.Everyone shines in our own way, and we are already pretty enough! After all, Venus has a broken arm.

To be continue...



作者:乌然娅措
链接:https://www.jianshu.com/p/42b8750136a5


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/132/viewspace-2817297/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: JQuery动画
请登录后发表评论 登录
全部评论

注册时间:2019-04-24

  • 博文量
    70
  • 访问量
    12485