GET DATA /TYPE=XLSX /FILE='C:\Users\logic\Desktop\Copy of PG_Assignment.xlsx' /SHEET=name 'Sheet1' /CELLRANGE=full /READNAMES=on /ASSUMEDSTRWIDTH=32767. EXECUTE. DATASET NAME DataSet1 WINDOW=FRONT.
CROSSTABS /TABLES=colorpref BY gender /FORMAT=AVALUE TABLES /STATISTICS=CHISQ /CELLS=COUNT EXPECTED /COUNT ROUND CELL.
Crosstabs
Notes Output Created Comments Active Dataset Filter Input Weight Split File N of Rows in Working Data File User-defined missing Definition of Missing values are treated as missing. Missing Value Handling Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table. DataSet1 <none> <none> <none> 60 30-DEC-2012 19:20:28
CROSSTABS /TABLES=colorpref BY gender /FORMAT=AVALUE Syntax TABLES /STATISTICS=CHISQ /CELLS=COUNT EXPECTED /COUNT ROUND CELL. Processor Time Resources Elapsed Time Dimensions Requested Cells Available 00:00:00.02 00:00:00.02 2 174762
[DataSet1]
Case Processing Summary Cases Valid N colorpref * gender 60 Percent 100.0% N 0 Missing Percent 0.0% N 60 Total Percent 100.0%
colorpref * gender Crosstabulation gender 0 colorpre f 0 Count Expected Count Count 1 Expected Count 2 Count 20 13.3 20 13.3 0 1 0 6.7 0 6.7 20 20 20.0 20 20.0 20 Total
Expected Count Count Total Expected Count
13.3 40 40.0
6.7 20 20.0
20.0 60 60.0
Chi-Square Tests Value df Asymp. Sig. (2-sided) Pearson Chi-Square Likelihood Ratio Linear-by-Linear Association N of Valid Cases 60.000a 76.382 44.250 60 2 2 1 .000 .000 .000
a. 0 cells (0.0%) have expected count less than 5. The minimum expected count is 6.67.
As per the question, using analyse, descriptive and crosstabs,we examine the relationship between the two categorical variables colour preference and gender(looking at the crosstabulation tables).The 1st cell shows 20 of the females prefer blue colour. The expected count is given by (row total*column total)/total. The expected count shows the no. of cases that would be expected if the column and row variable are statistically independent. The Pearsons Chi-square value=sum of ( (obs-exp)/exp)^2 .Here we test the null hypothesis that there is no association between colour preference and gender gainst the alternative hypothesis that they are related.Here the p-value is 0.000 is less than .05.So we reject the null hypothesis and accept that gender is related to colour preference.Here all the assumptions if chi-square are satisfied since no cell has expected count less than 5.
RECODE age (Lowest thru 30=1) (31 thru 40=2) (41 thru 50=3) (51 thru Highest=4) INTO agecat. VARIABLE LABELS agecat 'age categorical'. EXECUTE. CROSSTABS /TABLES=colorpref BY gender BY agecat /FORMAT=AVALUE TABLES /STATISTICS=CHISQ /CELLS=COUNT EXPECTED /COUNT ROUND CELL.
Crosstabs
Notes Output Created Comments Active Dataset Filter Input Weight Split File N of Rows in Working Data File User-defined missing Definition of Missing values are treated as missing. Missing Value Handling Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table. CROSSTABS /TABLES=colorpref BY gender BY agecat /FORMAT=AVALUE Syntax TABLES /STATISTICS=CHISQ /CELLS=COUNT EXPECTED /COUNT ROUND CELL. Processor Time Resources Elapsed Time Dimensions Requested Cells Available 00:00:00.02 00:00:00.02 3 142987 DataSet1 <none> <none> <none> 60 30-DEC-2012 19:27:22
[DataSet1]
Case Processing Summary Cases Valid N colorpref * gender * age categorical 60 Percent 100.0% N 0 Missing Percent 0.0% N 60 Total Percent 100.0%
colorpref * gender * age categorical Crosstabulation age categorical 0 Count 0 Expected Count colorpre f 1 2 Count 1 Expected Count Count Expected Count Count Total Expected Count Count 0 colorpre f 2 1 Expected Count Count Expected Count Count Total 3 colorpre 0 Expected Count Count 9 5.4 6 3.6 0 6.0 15 15.0 5 5.0 4 4.0 9 9.0 4 0 gender 1 0 3.6 0 2.4 10 4.0 10 10.0 9 9.0 6 6.0 10 10.0 25 25.0 5 5.0 4 4.0 9 9.0 4 Total
Expected Count Count f 1 Expected Count Count 2 Expected Count Count Total Expected Count Count 0 colorpre f 4 2 Expected Count Count Expected Count Count Total Expected Count Count 0 Total colorpre f 1 Expected Count Count Expected Count
2.5 10 6.4 0 5.1 14 14.0 2 1.0 0 1.0 2 2.0 20 13.3 20 13.3
1.5 0 3.6 8 2.9 8 8.0 0 1.0 2 1.0 2 2.0 0 6.7 0 6.7
4.0 10 10.0 8 8.0 22 22.0 2 2.0 2 2.0 4 4.0 20 20.0 20 20.0
colorpref * gender * age categorical Crosstabulation age categorical 0 Total colorpre f 2 Count Expected Count Count Total Expected Count 0 13.3 40 40.0 gender 1 20 6.7 20 20.0 20 20.0 60 60.0 Total
Chi-Square Tests
age categorical
Value
df
Asymp. Sig. (2-sided)
Exact Sig. (2sided)
Pearson Chi-Square Likelihood Ratio 1 Linear-by-Linear Association N of Valid Cases 2 Pearson Chi-Square N of Valid Cases Pearson Chi-Square Likelihood Ratio 3 Linear-by-Linear Association N of Valid Cases Pearson Chi-Square Continuity Correction Likelihood Ratio 4 Fisher's Exact Test Linear-by-Linear Association N of Valid Cases Pearson Chi-Square Likelihood Ratio Total Linear-by-Linear Association N of Valid Cases
f
25.000
2 2 1
.000 .000 .000
33.651 19.443 25 .c 9 22.000d 28.841 15.677 22 4.000e 1.000 5.545
2 2 1
.000 .000 .000
1 1 1
.046 .317 .019 .333
3.000 4 60.000a 76.382 44.250 60
.083
2 2 1
.000 .000 .000
Chi-Square Tests age categorical Pearson Chi-Square 1 Likelihood Ratio Linear-by-Linear Association N of Valid Cases 2 3 Pearson Chi-Square N of Valid Cases Pearson Chi-Square Likelihood Ratio Linear-by-Linear Association Exact Sig. (1-sided)
N of Valid Cases Pearson Chi-Square Continuity Correctionf 4 Likelihood Ratio Fisher's Exact Test Linear-by-Linear Association N of Valid Cases Pearson Chi-Square Total Likelihood Ratio Linear-by-Linear Association N of Valid Cases a. 0 cells (0.0%) have expected count less than 5. The minimum expected count is 6.67. b. 4 cells (66.7%) have expected count less than 5. The minimum expected count is 2.40. c. No statistics are computed because gender is a constant. d. 4 cells (66.7%) have expected count less than 5. The minimum expected count is 1.45. e. 4 cells (100.0%) have expected count less than 5. The minimum expected count is 1.00. f. Computed only for a 2x2 table .167
Next we add age as layer to check if age has any influence on the relation between the categorical variables colour preference and gender.So we convert age into nominal variable by grouping as follows: Age 31-40 41-50 51and above Group 1 2 3 4 30 and below
Here all the p-values are less than .05 which says gender is still related to colour preference and this relation that we got in the previous table was not merely an artifact of the relation between age and colour preference.But here the expected count is less than 5 in most cases.So the assumption that the sample size is large ,is not satisfied.So either we recode age into different categories clubbing those which have expected count less than 5 with those having expected count>5.Or we can draw our conclusion from Fishers exact test.Here p value is greater than . 05.So we accept the null hypothesis.Thus colour preference is independent of gender. The previous relation which we got was due to the underying influence of age.So age has a role in
this context.
Notes Output Created Comments Active Dataset Filter Input Weight Split File N of Rows in Working Data File User-defined missing Definition of Missing values are treated as missing. Missing Value Handling Cases Used Statistics for each table are based on all the cases with valid data in the specified range(s) for all variables in each table. CROSSTABS /TABLES=colorpref BY gender BY agenew /FORMAT=AVALUE Syntax TABLES /STATISTICS=CHISQ /CELLS=COUNT EXPECTED /COUNT ROUND CELL. Processor Time Resources Elapsed Time Dimensions Requested Cells Available 00:00:00.00 00:00:00.03 3 142987 DataSet1 <none> <none> <none> 60 30-DEC-2012 19:32:02
Notes Output Created Comments 30-DEC-2012 19:35:38
Active Dataset Filter Input Weight Split File N of Rows in Working Data File
DataSet1 <none> <none> <none> 60 User-defined missing
Definition of Missing
values are treated as missing. Statistics for each table are based on all the cases with
Missing Value Handling Cases Used
valid data in the specified range(s) for all variables in each table. CROSSTABS /TABLES=colorpref BY gender BY agenew /FORMAT=AVALUE
Syntax
TABLES /STATISTICS=CHISQ /CELLS=COUNT EXPECTED /COUNT ROUND CELL. Processor Time 00:00:00.02 00:00:00.04 3 142987
Resources
Elapsed Time Dimensions Requested Cells Available