<jupyter_start><jupyter_text>1.The sample design method used in this study survey was a master sampling method which consist of two diffrent survey methods. At first they used a stratified design where they divided the country's population into provinces with probability proportional to size sampling. Thenafter they used systematic sampling where they selected regions with the provinces randomly from the dwelling units. In the stratidied sampling they focused on metro and non-metro areas(primary), the secondary stage part of the survey they summarized the 2001 primary sampling units.<jupyter_code>DATA <- read.csv("GHS_2013_PERSON_F1.csv") #This imports GHS2013Report csv file<jupyter_output><empty_output><jupyter_text>2. Sample size of the study<jupyter_code>data <-DATA[(DATA$Q42aSTO>20000 & DATA$Q42aSTO<=750000),] #This will filter out the salaries that we want
dim(data) #This checks the dimensions to get the sample size<jupyter_output><empty_output><jupyter_text>Since the number of rows is 516 that means our sample size is 516  3. Choosing independent variables<jupyter_code>head(data) #This makes it easier to check the column names we want
names(data)[names(data) == "Q12aMARST"]<-"Marital_status"
names(data)[names(data) == "Race"]<- "population_group"
names(data)[names(data) == "disab"]<-"Disability"
names(data)[names(data) == "geotype"]<-"geotype"
names(data)[names(data) == "Age"]<-"Age"
names(data)[names(data) == "Q49RELIGIOUS"]<-"religion"
names(data)[names(data) == "Q16HIEDU"]<-"Education_level"
names(data)[names(data) == "Q42aSTO"]<-"Salaries"
dim(data) #This will give me my sample size
New_salaries_data <-data[c("Marital_status","population_group","Disability","geotype","Age","religion","Education_level","Salaries")] #This choose the independent variables we want
head(New_salaries_data) #This code checks if the variable names that I wanted are choosen<jupyter_output><empty_output><jupyter_text>4. Univariate Analysis<jupyter_code>pie(table(New_salaries_data$Marital_status),col = c("purple", "violetred1", "green3","cornsilk", "cyan", "white","red"), levels = c(1,2,3,4,5,6,7,9),label = c("Legally married","Living together like husband and wife"
,"Divorced","Separated but still legally married","Widowed","Single but have been living together with someone as husband"
,"Single and have never been married/never lived together as h","Unspecified")) #This code plots the pie chart for Marital_status coulmn with different colors

barplot(table(New_salaries_data$Marital_status),horiz=F,main="Marital_status") #This code plots the bar chart for Marital_status column
chisq.test(New_salaries_data$Marital_status)<jupyter_output>Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in title(main = ma[...]<jupyter_text>For Marital_status \Since $~P_{value} < \alpha ~$ We reject $H_0$<jupyter_code>pie(table(New_salaries_data$population_group),col = c("violetred1", "green3","cornsilk", "cyan"),levels = c(1,2,3,4),label = c("African/Black","
Coloured","Indian/Asian","White")) #This code plots the pie chart for population_group coulmn with different colors

barplot(table(New_salaries_data$population_group),horiz=F,main="population_group") #This code plots the bar chart for population_group column
chisq.test(New_salaries_data$population_group)<jupyter_output>Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in title(main = main, ...):
“"levels" is not a graphical parameter”<jupyter_text>For population_group \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>pie(table(New_salaries_data$Disability),col = c("cyan", "white","red"),levels = c(0,1,9), label=c("Not disabled"
,"Disabled","Unspecified")) #This code plots the pie chart for Disability coulmn with different colors

barplot(table(New_salaries_data$Disability),horiz=F,main="Disability") #This code plots the bar chart for Disability column
chisq.test(New_salaries_data$Disability)<jupyter_output>Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in title(main = main, ...):
“"levels" is not a graphical parameter”<jupyter_text>For Disability \Since $~P_{value} < \alpha ~$ We reject $H_0$<jupyter_code>pie(table(New_salaries_data$geotype),col = c("violetred1", "green3","cornsilk","red"),levels = c(1,2,4,5), label=c("Urban formal"
,"Urban informal",
"Tribal areas",
"Rural formal")) #This code plots the pie chart for geotype coulmn with different colors

barplot(table(New_salaries_data$geotype),horiz=F,main="geotype") #This code plots the bar chart for geotype column
chisq.test(New_salaries_data$geotype)<jupyter_output>Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in title(main = main, ...):
“"levels" is not a graphical parameter”<jupyter_text>For geotype \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>pie(table(New_salaries_data$Age),col = c("purple", "violetred1", "green3","cornsilk", "cyan", "white","red")) #This code plots the pie chart for Age coulmn with different colors

barplot(table(New_salaries_data$Age),horiz=F,main="Age") #This code plots the bar chart for Age column
chisq.test(New_salaries_data$Age)<jupyter_output><empty_output><jupyter_text>For Age \Since $~P_{value} < \alpha ~$ We reject $H_0$<jupyter_code>pie(table(New_salaries_data$religion),col = c("purple", "violetred1", "green3","cornsilk", "cyan", "white","red"),levels=c(1,2,3,4,5,6,7,8,9,91,92,93,98,99),label = c("Christian","Muslim","Acentral, tribal, animist, or other traditional African reli","Hindu","Buddhist","Bahai","Jewish","Atheist","Agnostic","Something else","Nothing in particular","Refused","Do not know","Unspecified")) #This code plots the pie chart for religion coulmn with different colors

barplot(table(New_salaries_data$religion),horiz=F,main="religion") #This code plots the bar chart for religion column
chisq.test(New_salaries_data$religion)<jupyter_output>Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.[...]<jupyter_text>For religion \Since $~P_{value} < \alpha ~$ We reject $H_0$<jupyter_code>pie(table(New_salaries_data$Education_level),col = c("purple", "violetred1", "green3","cornsilk", "cyan", "white","red"),levels = c(0,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,98,99),label=c("Grade R/0","Grade 1/Sub A/Class 1","Grade 2/Sub B/Class 2","Grade 3/Standard 1/AET 1(Kha Ri Gude, Sanli)","Grade 4/Standard 2","Grade 5/Standard 3/AET 2","Grade 6/Standard 4","Grade 7/Standard 5/AET 3","Grade 8/Standard 6/Form 1","Grade 9/Standard 7/Form 2/AET 4","Grade 10/Standard 8/ Form 3","Grade 11/Standard 9/ Form 4","Grade 12/Standard 10/Form 5/Matric (No Exemption)","Grade 12/Standard 10/Form 5/Matric (Exemption *)","NTC 1 N1/NC (V) Level 2","NTC 2/N2/ NC (V) Level 3","NTC 3/ N3/NC (V)/Level 4","N4/NTC 4","N5/NTC 5","N6/NTC 6","Certificate with less than Grade 12/Std 10","Diploma with less than Grade 12/Std 10","Certificate with Grade 12/Std 10","Diploma with Grade 12/Std 10
","Higher Diploma (Technikon/University of Technology)","Post Higher Diploma (Technikon/University of Technology Mast","Bachelor's Degree
","Bachelor's Degree and post-graduate diploma",
"Honours Degree","Higher degree (Masters, Doctorate)","Other (specify in the box below)","Do not know","No schooling","Unspecified")
) #This code plots the pie chart for ducation_level coulmn with different colors

barplot(table(New_salaries_data$Education_level),horiz=F,main="Education_level") #This code plots the bar chart forducation_level column
chisq.test(New_salaries_data$Education_level)<jupyter_output>Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj = ifelse(P$x < :
“"levels" is not a graphical parameter”
Warning message in text.default(1.[...]<jupyter_text>For Education_level \Since $~P_{value} < \alpha ~$ We reject $H_0$   5. Bivariate Analysis<jupyter_code>kruskal.test(New_salaries_data$Salaries,New_salaries_data$Marital_status)<jupyter_output><empty_output><jupyter_text>For Marital_status \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>kruskal.test(New_salaries_data$Salaries,New_salaries_data$population_group)<jupyter_output><empty_output><jupyter_text>For population group \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>kruskal.test(New_salaries_data$Salaries,New_salaries_data$Disability)<jupyter_output><empty_output><jupyter_text>For Disability \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>kruskal.test(New_salaries_data$Salaries,New_salaries_data$geotype)<jupyter_output><empty_output><jupyter_text>For geotype \Since $~P_{value} < \alpha ~$ We reject $H_0$<jupyter_code>kruskal.test(New_salaries_data$Salaries,New_salaries_data$religion)<jupyter_output><empty_output><jupyter_text>For religion \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>kruskal.test(New_salaries_data$Salaries,New_salaries_data$Education_level)<jupyter_output><empty_output><jupyter_text>For Education level \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>kruskal.test(New_salaries_data$Salaries,New_salaries_data$Age)<jupyter_output><empty_output><jupyter_text>For Age \Since $~P_{value} > \alpha ~$ We do not have enough evidence to reject $H_0$<jupyter_code>plot(New_salaries_data)
multiple.regression <- lm(Salaries ~ population_group+Disability+geotype+Age+religion+Education_level+Marital_status,data=New_salaries_data)
summary(multiple.regression)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14888174243531646, 'fraction_numerical': 0.027262096184768308, 'mean_word_length': 6.489326765188834, 'pattern_counts': {'":': 0, '<': 118, '<?xml version=': 0, '>': 76, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '18', 'dir': 'jupyter-structured-clean-dedup', 'id': '319335', 'license': 'MIT', 'n_tokens_mistral': 5242, 'n_tokens_neox': 4860, 'n_words': 1329, 'path': 'musawenkosi-statistics-Question1-assignment-02.ipynb', 'repo_name': 'musawenkosikhulu/Statistic-using-R', 'size': '13682'}