library(ggplot2)
library(readr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ResourceSelection)
## ResourceSelection 0.3-6 2023-06-27
LF_data <- read_csv("/Volumes/John Dre WD/Unisa 2024/STA4813/Assignment 03/Labour_Force.csv")
## Rows: 45702 Columns: 9
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (9): UQNO, Q13GENDER, Q14AGE, Q15POPULATION, Q16MARITALSTATUS, Q24APDWRK...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Convert specific columns to factors
LF_data<- LF_data %>%
mutate(Q13GENDER = factor(Q13GENDER, levels = c(1, 2), labels = c("Male", "Female")),
Q15POPULATION = factor(Q15POPULATION, levels = c(1, 2, 3, 4), labels = c("African/Black", "Coloured", "Indian/Asian", "White")),
Q24APDWRK = factor(Q24APDWRK , levels = c(1, 2), labels = c("Yes", "No")),
Q16MARITALSTATUS = factor(Q16MARITALSTATUS, levels = c(1, 2, 3, 4, 5), labels =
c("Married", "Living together", "Widow/Widower", "Divorced/Separated", "Never married")),
Education_Status = factor(Education_Status, levels = c(1, 2, 3, 4, 5, 6, 7), labels =
c("No schooling", "Less than primary completed", "Primary completed", "Secondary not completed", "Secondary completed", "Tertiary", "Other")),
Province = factor(Province, levels = c(1, 2, 3, 4, 5, 6, 7, 8, 9), labels =
c("Western Cape", "Eastern Cape", "Northern Cape", "Free State", "KwaZulu-Natal", "North West", "Gauteng", "Mpumalanga", "Limpopo")),
Geo_type_code = factor(Geo_type_code, levels = c(1, 2, 3), labels = c("Urban", "Traditional", "Farms")))
head(LF_data)
## # A tibble: 6 × 9
## UQNO Q13GENDER Q14AGE Q15POPULATION Q16MARITALSTATUS Q24APDWRK
## <dbl> <fct> <dbl> <fct> <fct> <fct>
## 1 1.60e17 Female 27 Coloured Living together Yes
## 2 1.60e17 Male 29 Coloured Living together Yes
## 3 1.60e17 Male 8 Coloured Never married <NA>
## 4 1.60e17 Male 6 Coloured Never married <NA>
## 5 1.60e17 Female 27 White Never married No
## 6 1.60e17 Female 66 White Divorced/Separated Yes
## # ℹ 3 more variables: Education_Status <fct>, Province <fct>,
## # Geo_type_code <fct>
tail(LF_data)
## # A tibble: 6 × 9
## UQNO Q13GENDER Q14AGE Q15POPULATION Q16MARITALSTATUS Q24APDWRK
## <dbl> <fct> <dbl> <fct> <fct> <fct>
## 1 9.87e17 Male 6 African/Black Never married <NA>
## 2 9.87e17 Male 68 African/Black Widow/Widower No
## 3 9.87e17 Male 20 African/Black Never married No
## 4 9.87e17 Female 14 African/Black Never married <NA>
## 5 9.87e17 Female 48 African/Black Never married No
## 6 9.87e17 Male 2 African/Black Never married <NA>
## # ℹ 3 more variables: Education_Status <fct>, Province <fct>,
## # Geo_type_code <fct>
The “LabourForce.csv” dataset contains 45702 observations which are classified into 9 different variables (or 9 columns). This large dataset contains a notable number of missing values which will be addressed in the upcoming analysis.
names(LF_data)
## [1] "UQNO" "Q13GENDER" "Q14AGE" "Q15POPULATION"
## [5] "Q16MARITALSTATUS" "Q24APDWRK" "Education_Status" "Province"
## [9] "Geo_type_code"
str(LF_data)
## tibble [45,702 × 9] (S3: tbl_df/tbl/data.frame)
## $ UQNO : num [1:45702] 1.6e+17 1.6e+17 1.6e+17 1.6e+17 1.6e+17 ...
## $ Q13GENDER : Factor w/ 2 levels "Male","Female": 2 1 1 1 2 2 2 2 2 2 ...
## $ Q14AGE : num [1:45702] 27 29 8 6 27 66 59 62 73 64 ...
## $ Q15POPULATION : Factor w/ 4 levels "African/Black",..: 2 2 2 2 4 4 4 4 4 4 ...
## $ Q16MARITALSTATUS: Factor w/ 5 levels "Married","Living together",..: 2 2 5 5 5 4 4 1 3 4 ...
## $ Q24APDWRK : Factor w/ 2 levels "Yes","No": 1 1 NA NA 2 1 1 2 2 2 ...
## $ Education_Status: Factor w/ 7 levels "No schooling",..: 4 4 2 1 6 6 5 6 5 5 ...
## $ Province : Factor w/ 9 levels "Western Cape",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ Geo_type_code : Factor w/ 3 levels "Urban","Traditional",..: 3 3 3 3 1 1 1 1 1 1 ...
A list of the names of variables, as well as the types contained in each variables are depicted in the codes above, using the “names” and “str” functions. The dataset is primarily qualitative by design, with most variables stored as factors. Only “UQNO” and “Q14AGE” are numeric or quantitative variables.
summary(LF_data)
## UQNO Q13GENDER Q14AGE Q15POPULATION
## Min. :1.601e+17 Male :21222 Min. : 0.0 African/Black:39540
## 1st Qu.:4.671e+17 Female:24480 1st Qu.: 12.0 Coloured : 2923
## Median :5.992e+17 Median : 27.0 Indian/Asian : 848
## Mean :6.288e+17 Mean : 30.1 White : 2391
## 3rd Qu.:7.991e+17 3rd Qu.: 45.0
## Max. :9.871e+17 Max. :119.0
##
## Q16MARITALSTATUS Q24APDWRK Education_Status
## Married : 8418 Yes : 8245 No schooling : 6915
## Living together : 2166 No :23698 Less than primary completed: 9074
## Widow/Widower : 2453 NA's:13759 Primary completed : 2325
## Divorced/Separated: 865 Secondary not completed :14666
## Never married :31800 Secondary completed : 8947
## Tertiary : 3522
## Other : 253
## Province Geo_type_code
## Gauteng :9946 Urban :26896
## KwaZulu-Natal:9296 Traditional:17580
## Limpopo :5988 Farms : 1226
## Eastern Cape :5739
## Mpumalanga :4413
## Western Cape :3678
## (Other) :6642
A summary statistics of the dataset is presented above. For “Q14AGE”, the maximum age value of 119.0 seems like an outlier. Similarly, “Q15POPULATION” (with 39540), “Q16MARITALSTATUS” (with 31800), “Education_Status” (with 14666), A further examination in the course of our analysis should be conducted to verify these values.
PROBLEMS:
(a) Plot the relationship between the response Paid work and a household member aged 15 years and older (Hint: you should extract the data from Age variable). Explain why the plot does not work well
age_work_data <- subset(LF_data, select = c("Q14AGE", "Q24APDWRK"))
# Sort the data in ascending order by Q14AGE column
age_work_data <- age_work_data[order(age_work_data$Q14AGE), ]
# Filter the data for ages 15 and above
filtered_data <- subset(LF_data, Q14AGE >= 15)
# Create the scatterplot
library(ggplot2)
ggplot(filtered_data, aes(x = Q14AGE, y = Q24APDWRK)) +
geom_point() +
labs(x = "Age", y = "Paid work") +
theme_minimal()
The plot may not work well due to the nature of the “Paid work” variable. “Q24APDWRK” is a categorical variable with two levels: 1 = Yes and 2 = No; while the age variable is a continuous variable that represents the age of household members.Thus a scatter plot or line plot would not provide meaningful information since the “Paid work” variable does not have a natural order or quantifiable scale. Other visualization techniques (e.g a boxplot) might be more suitable for examining the relationship between a categorical variable and a continuous variable.
(b) Fit a binary regression with Paid work as the response and the other seven variables as predictors, excluding variable UQNO. Report the residual deviance and associated degrees of freedom. Can this information be used to determine if this model fits the data? Explain.
# Fit binary regression model
model <- glm(Q24APDWRK ~ . - UQNO, data = LF_data, family = binomial)
model
##
## Call: glm(formula = Q24APDWRK ~ . - UQNO, family = binomial, data = LF_data)
##
## Coefficients:
## (Intercept)
## 1.903543
## Q13GENDERFemale
## 0.309081
## Q14AGE
## -0.007684
## Q15POPULATIONColoured
## 0.039863
## Q15POPULATIONIndian/Asian
## 0.318566
## Q15POPULATIONWhite
## 0.616904
## Q16MARITALSTATUSLiving together
## -0.368157
## Q16MARITALSTATUSWidow/Widower
## 1.154962
## Q16MARITALSTATUSDivorced/Separated
## 0.054343
## Q16MARITALSTATUSNever married
## 0.572033
## Education_StatusLess than primary completed
## -0.710014
## Education_StatusPrimary completed
## -0.888367
## Education_StatusSecondary not completed
## -1.181793
## Education_StatusSecondary completed
## -1.894077
## Education_StatusTertiary
## -2.618660
## Education_StatusOther
## -0.892434
## ProvinceEastern Cape
## 0.349107
## ProvinceNorthern Cape
## 0.103029
## ProvinceFree State
## 0.263627
## ProvinceKwaZulu-Natal
## 0.273864
## ProvinceNorth West
## 0.141334
## ProvinceGauteng
## 0.347823
## ProvinceMpumalanga
## 0.127764
## ProvinceLimpopo
## 0.231909
## Geo_type_codeTraditional
## 0.675161
## Geo_type_codeFarms
## -0.687054
##
## Degrees of Freedom: 31942 Total (i.e. Null); 31917 Residual
## (13759 observations deleted due to missingness)
## Null Deviance: 36480
## Residual Deviance: 32330 AIC: 32380
# Get residual deviance and degrees of freedom
residual_deviance <- deviance(model)
df <- df.residual(model)
# Print the results
cat("Residual Deviance:", residual_deviance, "\n")
## Residual Deviance: 32328.37
cat("Degrees of Freedom:", df, "\n")
## Degrees of Freedom: 31917
Based on the provided output:
Residual Deviance: 32330 Degrees of Freedom: 31917
The residual deviance is 32330, and there are 31917 degrees of freedom associated with this model.
The residual deviance measures the lack of fit of the model to the data, where a smaller residual deviance indicates a better fit. This residual deviance looks relatively large for the model to be a good fit although to further evaluate the model’s fit, additional diagnostic measures such as goodness-of-fit tests, model comparison, and examining residuals should be considered. Hence, just the Residual Deviance: 32330 & Degrees of Freedom: 31917 are not enough to conclude.
(c) Use AIC as the criterion to determine the best subset of variables. (Use the step function.)
# Fit binary regression model
model <- glm(Q24APDWRK ~ . - UQNO, data = LF_data, family = binomial)
# Perform stepwise variable selection using AIC
best_model <- step(model, direction = "both", trace = FALSE)
best_model
##
## Call: glm(formula = Q24APDWRK ~ (UQNO + Q13GENDER + Q14AGE + Q15POPULATION +
## Q16MARITALSTATUS + Education_Status + Province + Geo_type_code) -
## UQNO, family = binomial, data = LF_data)
##
## Coefficients:
## (Intercept)
## 1.903543
## Q13GENDERFemale
## 0.309081
## Q14AGE
## -0.007684
## Q15POPULATIONColoured
## 0.039863
## Q15POPULATIONIndian/Asian
## 0.318566
## Q15POPULATIONWhite
## 0.616904
## Q16MARITALSTATUSLiving together
## -0.368157
## Q16MARITALSTATUSWidow/Widower
## 1.154962
## Q16MARITALSTATUSDivorced/Separated
## 0.054343
## Q16MARITALSTATUSNever married
## 0.572033
## Education_StatusLess than primary completed
## -0.710014
## Education_StatusPrimary completed
## -0.888367
## Education_StatusSecondary not completed
## -1.181793
## Education_StatusSecondary completed
## -1.894077
## Education_StatusTertiary
## -2.618660
## Education_StatusOther
## -0.892434
## ProvinceEastern Cape
## 0.349107
## ProvinceNorthern Cape
## 0.103029
## ProvinceFree State
## 0.263627
## ProvinceKwaZulu-Natal
## 0.273864
## ProvinceNorth West
## 0.141334
## ProvinceGauteng
## 0.347823
## ProvinceMpumalanga
## 0.127764
## ProvinceLimpopo
## 0.231909
## Geo_type_codeTraditional
## 0.675161
## Geo_type_codeFarms
## -0.687054
##
## Degrees of Freedom: 31942 Total (i.e. Null); 31917 Residual
## (13759 observations deleted due to missingness)
## Null Deviance: 36480
## Residual Deviance: 32330 AIC: 32380
summary(best_model)
##
## Call:
## glm(formula = Q24APDWRK ~ (UQNO + Q13GENDER + Q14AGE + Q15POPULATION +
## Q16MARITALSTATUS + Education_Status + Province + Geo_type_code) -
## UQNO, family = binomial, data = LF_data)
##
## Coefficients:
## Estimate Std. Error z value
## (Intercept) 1.903543 0.147108 12.940
## Q13GENDERFemale 0.309081 0.027762 11.133
## Q14AGE -0.007684 0.001167 -6.586
## Q15POPULATIONColoured 0.039863 0.058696 0.679
## Q15POPULATIONIndian/Asian 0.318566 0.090888 3.505
## Q15POPULATIONWhite 0.616904 0.056805 10.860
## Q16MARITALSTATUSLiving together -0.368157 0.054153 -6.798
## Q16MARITALSTATUSWidow/Widower 1.154962 0.077854 14.835
## Q16MARITALSTATUSDivorced/Separated 0.054343 0.080652 0.674
## Q16MARITALSTATUSNever married 0.572033 0.038882 14.712
## Education_StatusLess than primary completed -0.710014 0.126272 -5.623
## Education_StatusPrimary completed -0.888367 0.135472 -6.558
## Education_StatusSecondary not completed -1.181793 0.117529 -10.055
## Education_StatusSecondary completed -1.894077 0.118638 -15.965
## Education_StatusTertiary -2.618660 0.121133 -21.618
## Education_StatusOther -0.892434 0.208139 -4.288
## ProvinceEastern Cape 0.349107 0.063727 5.478
## ProvinceNorthern Cape 0.103029 0.088387 1.166
## ProvinceFree State 0.263627 0.072143 3.654
## ProvinceKwaZulu-Natal 0.273864 0.059235 4.623
## ProvinceNorth West 0.141334 0.077985 1.812
## ProvinceGauteng 0.347823 0.054004 6.441
## ProvinceMpumalanga 0.127764 0.068523 1.865
## ProvinceLimpopo 0.231909 0.070299 3.299
## Geo_type_codeTraditional 0.675161 0.039709 17.003
## Geo_type_codeFarms -0.687054 0.076815 -8.944
## Pr(>|z|)
## (Intercept) < 2e-16 ***
## Q13GENDERFemale < 2e-16 ***
## Q14AGE 4.53e-11 ***
## Q15POPULATIONColoured 0.497047
## Q15POPULATIONIndian/Asian 0.000457 ***
## Q15POPULATIONWhite < 2e-16 ***
## Q16MARITALSTATUSLiving together 1.06e-11 ***
## Q16MARITALSTATUSWidow/Widower < 2e-16 ***
## Q16MARITALSTATUSDivorced/Separated 0.500443
## Q16MARITALSTATUSNever married < 2e-16 ***
## Education_StatusLess than primary completed 1.88e-08 ***
## Education_StatusPrimary completed 5.47e-11 ***
## Education_StatusSecondary not completed < 2e-16 ***
## Education_StatusSecondary completed < 2e-16 ***
## Education_StatusTertiary < 2e-16 ***
## Education_StatusOther 1.81e-05 ***
## ProvinceEastern Cape 4.30e-08 ***
## ProvinceNorthern Cape 0.243751
## ProvinceFree State 0.000258 ***
## ProvinceKwaZulu-Natal 3.78e-06 ***
## ProvinceNorth West 0.069939 .
## ProvinceGauteng 1.19e-10 ***
## ProvinceMpumalanga 0.062246 .
## ProvinceLimpopo 0.000971 ***
## Geo_type_codeTraditional < 2e-16 ***
## Geo_type_codeFarms < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 36484 on 31942 degrees of freedom
## Residual deviance: 32328 on 31917 degrees of freedom
## (13759 observations deleted due to missingness)
## AIC: 32380
##
## Number of Fisher Scoring iterations: 5
The AIC value for the best model is also provided as 32380. The best_model includes the following variables: Q13GENDER, Q14AGE, Q15POPULATION, Q16MARITALSTATUS, Education_Status, Province, Geo_type_code.
The significance of each variable can be determined by looking at the corresponding p-values. The variables named are with p-values less than the alpha = 0.05 level and are considered statistically significant. In the provided output, variables with p-values less than 0.05 are denoted with asterisks (***) next to their estimates.
(d) Plot the deviance residuals against the fitted values. What can be concluded from this plot?
# Calculate deviance residuals
deviance_resid <- residuals(best_model, type = "deviance")
# Plot deviance residuals against fitted values
plot(fitted(best_model), deviance_resid, xlab = "Fitted Values", ylab = "Deviance Residuals", main = "Deviance Residuals vs. Fitted Values")
The deviance residuals vs. fitted values above exhibit a curved pattern: one on the left side representing the deviance residuals for lower fitted values and another on the right side representing the deviance residuals for higher fitted values. This indicates a non-linear relationship between the predictors and the response variable. Also, the spread of the deviance residuals appears to vary across the range of fitted values, suggesting the presence of heteroscedasticity (or non-constant variance). Potentially incorporating additional variables or transformations of variables may be needed to address the heteroscedasticity. Potential outliers or influential observations may also be present as we closely examine the points that deviate significantly from the curved patterns or have large absolute values of deviance residuals.
Overall, model improvement may be necessary as the current model may not adequately capture the underlying relationship between the predictors and the response variable. Further model refinement, such as considering non-linear terms or interactions, may be necessary to improve the fit to the data.
(e) Produce a binned residual plot as described in the Learning Unit 3 lecture notes. You will need to select an appropriate amount of binning. Comment on the plot.
# Calculate residuals
residuals <- residuals(best_model)
# Determine bin size
bin_size <- 20
# Create binned residual plot
binned_residuals <- tapply(residuals, cut(fitted(best_model), bin_size), mean)
plot(binned_residuals, type = "h", xlab = "Fitted Values", ylab = "Mean Residuals", main = "Binned Residual Plot")
Based on the binned residual plot, we can observe that the mean residuals appear to be relatively constant across the range of fitted values. This suggests that the model captures the overall trend in the data reasonably well.
However, there are some variability in the spread of the mean residuals, as seen by the varying heights of the bars. This indicates that the variability of the residuals is not constant across the range of fitted values. Again, heteroscedasticity suggests that the model may not adequately capture the variability in the data, especially for certain ranges of fitted values.
Consequently, further investigation and potential model refinement e.g. additional variables or transformations may be necessary to better capture the underlying relationships in the data and reduce the heteroscedasticity.
(f) Plot the binned residuals against Age, i.e.,the predictor. Comment on the plot.
(g) Produce a normal QQ plot for the residuals. Interpret the plot.
# Calculate residuals
residuals <- residuals(model)
# Generate normal QQ plot
qqnorm(residuals)
qqline(residuals)
The Q-Q plot suggests that the residuals deviate from a normal distribution. The points on the plot do not closely follow the diagonal reference line, indicating departures from normality. This suggests that the assumption of normality for the residuals may be violated.
***___ (h) Make a plot of the leverages. Interpret the plot.___***
# Calculate the leverages
leverages <- hatvalues(model)
# Generate a plot of the leverages
plot(leverages, type = "h", xlab = "Observation", ylab = "Leverage", main = "Leverage Plot")
Based on the Leverage Plot, it appears that there are several observations with high leverage values. We visualize the plot as suggesting that the observations towards the right side of the plot have higher leverage values. These observations may have an unbalancing influence on the model’s outcome, and it would be necessary to examine them closely to understand their impact on the regression results.
***___ (i) Check the goodness of fit for model in part (b) by computing the Hosmer-Lemeshow statistic and associated p-value. What do you conclude?___***
# Load the necessary library
if (!require(ResourceSelection)) {
install.packages("ResourceSelection")
library(ResourceSelection)
}
# Fit the binary logistic regression model again for clarity
# Fit binary regression model
model <- glm(Q24APDWRK ~ . - UQNO, data = LF_data, family = binomial)
# Perform stepwise variable selection using AIC
best_model <- step(model, direction = "both", trace = FALSE)
best_model
##
## Call: glm(formula = Q24APDWRK ~ (UQNO + Q13GENDER + Q14AGE + Q15POPULATION +
## Q16MARITALSTATUS + Education_Status + Province + Geo_type_code) -
## UQNO, family = binomial, data = LF_data)
##
## Coefficients:
## (Intercept)
## 1.903543
## Q13GENDERFemale
## 0.309081
## Q14AGE
## -0.007684
## Q15POPULATIONColoured
## 0.039863
## Q15POPULATIONIndian/Asian
## 0.318566
## Q15POPULATIONWhite
## 0.616904
## Q16MARITALSTATUSLiving together
## -0.368157
## Q16MARITALSTATUSWidow/Widower
## 1.154962
## Q16MARITALSTATUSDivorced/Separated
## 0.054343
## Q16MARITALSTATUSNever married
## 0.572033
## Education_StatusLess than primary completed
## -0.710014
## Education_StatusPrimary completed
## -0.888367
## Education_StatusSecondary not completed
## -1.181793
## Education_StatusSecondary completed
## -1.894077
## Education_StatusTertiary
## -2.618660
## Education_StatusOther
## -0.892434
## ProvinceEastern Cape
## 0.349107
## ProvinceNorthern Cape
## 0.103029
## ProvinceFree State
## 0.263627
## ProvinceKwaZulu-Natal
## 0.273864
## ProvinceNorth West
## 0.141334
## ProvinceGauteng
## 0.347823
## ProvinceMpumalanga
## 0.127764
## ProvinceLimpopo
## 0.231909
## Geo_type_codeTraditional
## 0.675161
## Geo_type_codeFarms
## -0.687054
##
## Degrees of Freedom: 31942 Total (i.e. Null); 31917 Residual
## (13759 observations deleted due to missingness)
## Null Deviance: 36480
## Residual Deviance: 32330 AIC: 32380
# Compute the Hosmer-Lemeshow test
Hosmer_Lemeshow_test <- hoslem.test(best_model$y, fitted(best_model), g = 10)
# Print the results
Hosmer_Lemeshow_test
##
## Hosmer and Lemeshow goodness of fit (GOF) test
##
## data: best_model$y, fitted(best_model)
## X-squared = 52.539, df = 8, p-value = 1.324e-08
The Hosmer-Lemeshow goodness of fit test results in a X-squared value of 52.539 with 8 degrees of freedom and a very small p-value of 1.324e-08. A small p-value indicates that there is strong evidence against the null hypothesis, suggesting that there is a significant difference between the observed response and the predicted probabilities. Therefore, in this case, the p-value suggests that the model does not fit the data adequately.
(j) Interpret the estimated coefficients for the fitted model.
The estimated coefficients for the fitted logistic regression model are provided in the outputin part (b). Each coefficient represents the change in the log-odds of the response variable for a one-unit increase in the corresponding predictor variable, while holding all other variables constant.
Interpreting the estimated coefficients:
Intercept: The intercept term represents the estimated log-odds of the response variable when all predictor variables are set to zero.
Q13GENDERFemale: This coefficient of 0.309081 suggests that being female (compared to being male) is associated with an increase in the log-odds of the response variable.
Q14AGE: The coefficient of -0.007684 indicates that for each unit increase in age (assuming other variables are held constant), the log-odds of the response variable decrease slightly.
Q15POPULATIONColoured: A coefficient of 0.039863 suggests that being in the “Coloured” population category (compared to the reference category) is associated with a slight increase in the log-odds of the response variable.
Q15POPULATIONIndian/Asian: With a coefficient of 0.318566, being in the “Indian/Asian” population category (compared to the reference category) is associated with a higher increase in the log-odds of the response variable.
Q15POPULATIONWhite: Similarly, the coefficient of 0.616904 indicates that being in the “White” population category (compared to the reference category) is associated with a larger increase in the log-odds of the response variable.
Q16MARITALSTATUSLiving together: The coefficient of -0.368157 suggests that living together (compared to the reference category) is associated with a decrease in the log-odds of the response variable.
Q16MARITALSTATUSWidow/Widower: With a coefficient of 1.154962, being a widow or widower (compared to the reference category) is associated with a significant increase in the log-odds of the response variable.
Q16MARITALSTATUSDivorced/Separated: The coefficient of 0.054343 suggests that being divorced or separated (compared to the reference category) is associated with a slight increase in the log-odds of the response variable.
Q16MARITALSTATUSNever married: With a coefficient of 0.572033, being never married (compared to the reference category) is associated with a larger increase in the log-odds of the response variable.
Education_Status: The coefficients for different education status categories indicate the association between each category and the log-odds of the response variable, compared to the reference category (Education_StatusOther). For example, Education_StatusLess than primary completed has a coefficient of -0.710014, indicating a decrease in the log-odds compared to the reference category.
Province: The coefficients for different provinces represent the association between each province and the log-odds of the response variable, compared to the reference category (ProvinceLimpopo). For example, ProvinceEastern Cape has a coefficient of 0.349107, indicating an increase in the log-odds compared to the reference category.
Geo_type_code: The coefficients for different geographic type codes represent the association between each code and the log-odds of the response variable, compared to the reference category (Geo_type_codeFarms). For example, Geo_type_codeTraditional has a coefficient of 0.675161, indicating an increase in the log-odds compared to the reference category.