forked from HeatherARobinson/CHAMP-data-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCategorical chi comparisons
More file actions
38 lines (34 loc) · 1.14 KB
/
Categorical chi comparisons
File metadata and controls
38 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Ethnicity2<-alldata$Ethnicity
levels(Ethnicity2)
levels(Ethnicity2)[1:3]<-"White"
levels(Ethnicity2)
levels(Ethnicity2)[2:3]<-"Mixed black"
levels(Ethnicity2)
levels(Ethnicity2)[10:11]<-"Black"
levels(Ethnicity2)
levels(Ethnicity2)[3]<-"Asian"
levels(Ethnicity2)
levels(Ethnicity2)[5:8]<-"Asian"
levels(Ethnicity2)
levels(Ethnicity2)[7]<-"Asian"
levels(Ethnicity2)
levels(Ethnicity2)[5]<-"Black"
levels(Ethnicity2)
levels(Ethnicity2)[4]<-"other"
levels(Ethnicity2)[6]<-"other"
alldata$Ethnicity2<-Ethnicity2
regtable<-table(alldata$IsAccountRegistered, alldata$Ethnicity2)
chisq.test(regtable)
regtable2<-table(alldata$IsAccountRegistered, alldata$PostcodeDecile)
chisq.test(regtable2)
table(multi$measure1)
multi$measure1<-ifelse(multi$measure1==4,2,multi$measure1)
multi$measure1<-as.character(multi$measure1)
regtable3<-table(multi$IsAccountRegistered, multi$measure1)
chisq.test(regtable3)
#RUN THROUGH MULTI WITHOUT SELECTING MULTIPLE ENTRIES, THEN:
table(multi$measure1)
multi$measure1<-ifelse(multi$measure1==4,2,multi$measure1)
multi$measure1<-as.character(multi$measure1)
regtable3<-table(multi$IsAccountRegistered, multi$measure1)
chisq.test(regtable3)