应用统计学_卡方检验.ppt_第1页
应用统计学_卡方检验.ppt_第2页
应用统计学_卡方检验.ppt_第3页
应用统计学_卡方检验.ppt_第4页
应用统计学_卡方检验.ppt_第5页
已阅读5页,还剩28页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、a,1,BEO2255 Applied Statistics for Business,Week Six Analyzing categorical data: Chi-squared tests,a,2,This week lecture will cover.,Analysing categorical data (nominal) Chi-square test of differences between proportions Chi-square test of independence,a,3,SPSS单样本非参数检验,总体分布的chi-square检验 (1)目的: 根据样本数

2、据推断总体的分布与某个已知分布是否有显著差异-吻合性检验。 适用于分类资料的统计推断,a,4,SPSS单样本非参数检验,总体分布的chi-square检验 (2)基本假设: H0:总体分布与理论分布无显著差异 (3)基本方法 根据已知总体的构成比计算出样本中各类别的期望频数,计算实际观察频数与期望频数的差距,即:计算卡方值 卡方值较小,则实际频数和期望频数相差较小.如果P大于a,不能拒绝H0,认为总体分布与已知分布无显著差异.反之,a,5,SPSS单样本卡方检验,总体分布的chi-square检验 (4)基本操作步骤: 菜单:analyze-nonparametric test-chi squ

3、are 选定待检验变量入test variable list 框 确定待检验个案的取值范围(expected range) get from data:全部样本 use specified range:用户自定义个案范围 指定期望频数(expected values) all categories equal:所有类别有相同的构成比 value:用户自定义构成比,a,6,Categorical variable,Variables that describe categories of entities Dealing with them all the time in statistics

4、Making comparisons among variables For example, whether consumers prefer a particular brand of a product among other competing brands. Checking whether there is a relationship between two categorical variables Gender and preference for a product, whether the preference for a product is independent f

5、rom gender,a,7,Chi-square test for differences between proportions,This test involves with nominal data produced by multinomial experiment It is a generalisation of a binomial experiment These test the null hypothesis that data in the target population has a particular probability distribution. Exam

6、ple 1 We might test whether consumers are indifferent to which of four materials (glass, plastic, steel or aluminium) that could be used to make soft drink containers. The null hypothesis is that they are indifferent (or that equal numbers prefer glass, plastic, steel and aluminium).,a,8,Example 1,D

7、ata Let pG be the probability that an individual selected at random will nominate glass as his/her preference if required to make a choice. Similarly for pP (plastic), pS (steel) and pA (aluminium) Hypotheses HO: pG = pP = pS = pA = 0.25. HA: at least one pi 0.25. The alternative is that at least on

8、e material is more preferred (or less preferred) than the others.,a,9,Example 1cont.,Procedure: Select a random sample of, say, 100 consumers and determine their preferences. Under the null hypothesis We expect 25 consumers to nominate glass, 25 to nominate plastic, 25 to nominate steel and 25 to no

9、minate aluminium These are the expected frequencies, Ei. Ei = n pi. We compare the expected frequencies with the sample results or the observed frequencies, Oi. If they are approximately the same we would conclude that the null hypothesis is true. Oi Ei HO is probably true.,a,10,Example 1cont., Chi

10、square,We require a test statistic to decide whether the difference is large enough to reject the null hypothesis. We use chi square with G - 1 degrees of freedom where G is the number of groups.,Suppose in our example, 39 prefer glass, 16 prefer plastic, 20 prefer steel and 25 prefer aluminium. Rec

11、all that the expected frequencies were all 25.,a,11,Obtain the critical value of chi square Critical 23 = 7.82. Obtain the critical value at 5% significance level at 3 d.f., (Table E4, page 742, Berenson et.al. 2013) i.e. there is only a 5 percent chance or less that 23 7.82 if HO is true. Compariso

12、n of chi square values 23 = 12.08 7.82 reject HO. Conclusion: at the 5% significance level there is sufficient evidence to reject the null hypothesis. At least one of the probabilities (pi) is different. The sample results indicate that the materials are not equally preferred by consumers in the tar

13、get population. Thus, at least preferences for two materials are different.,a,12,Chi square test using SPSS,Example : Suppose that we want to test whether or not customers have a colour preference for packaging. Three different colours, Blue, Green 不同层为水平数积. (5)是否显示各分组的棒图(display clustered bar chart

14、s ),a,21,产生交叉列联表,进一步计算 cells选项:选择在频数分析表中输出各种百分比. row:行百分比(Row pct); column:列百分比(Col pct); total:总百分比(Tot pct);,a,22,分析列联表中变量间的关系,目的: 通过列联表分析,检验行列变量之间是否独立。 方法: 卡方检验:对品质数据的相关性进行度量,a,23,分析列联表中变量间的关系,卡方检验 年龄与工资收入交叉列联表 低 中 高 青 400 0 0 中 0 500 0 老 0 0 600 低 中 高 青 0 0 500 中 0 600 0 老 400 0 0,a,24,分析列联表中变量间

15、的关系,卡方检验基本步骤 (1)H0:行列变量之间无关联或相互独立 (2)构造卡方统计量 统计量服从(r-1)*(c-1)个自由度的卡方分布 count:观察(实际)频数 expected count:期望频数 (期望频数反映的是H0成立情况下的数据分布特征) Residual:剩余 (观察频数-期望频数),a,25,1、列联表,2、三维柱形图,3、二维条形图,从三维柱形图能清晰看出 各个频数的相对大小。,从二维条形图能看出,吸烟者中 患肺癌的比例高于不患肺癌的比例。,通过图形直观判断两个分类变量是否相关:,a,26,Tests of independence cont,Example 2 S

16、uppose we interviewed 400 people & asked them which of three age groups they are in (under 25, 25 to 60, and over 60). We also ask their response to the statement that “All imports of automobiles should be banned in order to protect the local industry” (agree, no view either way, disagree).,attitude

17、s towards banning imports agree no view disagree Total age group under 25 19 53 25 97 25 - 60 46 94 47 187 over 60 30 56 30 116 Total 95 203 102 400,a,27,Tests of independence cont,Example 2 cont. Null hypothesis: The null hypothesis is that answers to the two questions are independent. Under the nu

18、ll: Probover 60 and agree = Probover 60 Probagree Multiplication rule for independent events Expected frequency= Probover 60 Probagree sample size.,a,28,Procedure We set up a cross-tabulation showing the observed frequencies of answers to the two questions. We calculate the expected frequencies. Tes

19、t Our test is based on a comparison of the observed and expected frequencies. Short-cut for expected frequencies,a,29,Age *attitude to banning imports Cross tabulation,19.0,53.0,25.0,97.0,23.0,49.2,24.7,96.9,46.0,94.0,47.0,187.0,44.4,94.9,47.7,187.0,30.0,56.0,30.0,116.0,27.6,58.9,29.6,116.1,95.0,203

20、.0,102.0,400.0,95.0,203.0,102.0,400.0,Count,Expected Count,Count,Expected Count,Count,Expected Count,Count,Expected Count,Under 25,25-60,Over 60,Age,Group,Total,Agree,No view,Disagree,Attitude to ban imports,Total,Calculation for expected frequency of agree and over 60, 95 116 / 400,a,30,Age *attitu

21、de to banning imports Cross tabulation,19.0,53.0,25.0,97.0,23.0,49.2,24.7,96.9,46.0,94.0,47.0,187.0,44.4,94.9,47.7,187.0,30.0,56.0,30.0,116.0,27.6,58.9,29.6,116.1,95.0,203.0,102.0,400.0,95.0,203.0,102.0,400.0,Count,Expected Count,Count,Expected Count,Count,Expected Count,Count,Expected Count,Under 2

22、5,25-60,Over 60,Age,Group,Total,Agree,No view,Disagree,Attitude to ban imports,Total,The count (observed) and the expected are different, but different enough to reject the null?,a,31,Chi-squared test for independence,Rationale: Oij Eij HO is probably true. Test statistic We require a test statistic to decide whether the difference is large enough to reject the null hypothesis.,a,32,Chi-Square Tests,1.438,a,4,.837,1.517,4,.805,1.307,1,.758,400,Pearson Chi-Square,Likelihood Ratio,Linear-by-Linear,Association,N of Valid C

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论