= How to do a two way Chi-squared analysis from inputting aggregated frequency counts directly into SPSS = Here is a fictitious dataset describing the incidence of a certain type of brain-damage within a population subdivided by age. || ||<38%>Brain-damaged||<45%>Normal|| ||<17%>Young||<38%>23||<45%>12|| ||<17%>Old||<38%>13||<45%>11|| '''Input the row and column categories and counts.''' Enter these into an SPSS DATA sheet with variables (columns) named: * '''''damaged''''' (coded Brain-damaged = 1 or Normal = 2)''''',''''' * '''''agegroup''''' (coded Young = 1 or Old = 2), and * '''''count.''''' ||damaged||agegroup||count|| ||1||1||23|| ||2||1||12|| ||1||2||13|| ||2||2||11|| '''Now 'weight' the data.'''Click on DATA on menu then click on WEIGHT CASES, click on WEIGHT CASES BY and then put the counts column into the frequency variable box. Click on OK. '''Now analyze the data.'''Click on ANALYZE:DESCRIPTIVE STATISTICS:CROSSTABS. Place one categorical variable in the row window and the other in the column window using the arrow buttons (order not important). Click on STATISTICS then on CHI-SQUARE then click CONTINUE. Click on OK. The output should now contain the results of a chi-square analysis. ''Chi-square(1)=0.80, (two-sided) p=0.37 so conclude no relationship between age and amount of brain damage.'' '''Here is the syntax corresponding to the above:''' {{{ WEIGHT BY count . CROSSTABS /TABLES=damaged BY agegroup /FORMAT= AVALUE TABLES /STATISTIC=CHISQ /CELLS= COUNT . }}} * [[FAQ/eqtots|An example where the table rows have identical totals]] [Last updated 21 January, 2011] ---- [[FAQ|Return to Statistics FAQ page]] [[CbuStatistics|Return to Statistics main page]] [[http://www.mrc-cbu.cam.ac.uk/|Return to CBU main page]] These pages are maintained by [[mailto:ian.nimmo-smith@mrc-cbu.cam.ac.uk|Ian Nimmo-Smith]] and [[mailto:peter.watson@mrc-cbu.cam.ac.uk|Peter Watson]]