Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 16 pages
Exam (elaborations)

STA4813 Assignment 1 (194267) |COMPLETE GUIDE| - DUE 21 MAY 2026

Document preview thumbnail
Preview 3 out of 16 pages

STA4813 Assignment 1 (194267) |COMPLETE GUIDE| - DUE 21 MAY 2026 100% COMPLETE ANSWERS

Content preview

STA4813
Assignment 1
(194267)

DUE: 21 MAY 2026

, UNIVERSITY OF SOUTH AFRICA
Department of Statistics
STA4813 – Generalised Linear Models
Assessment 01 | Unique Nr.: 194267 | Due: 21 May 2026


Theme: Child Health – NIDS Wave 1 (South Africa)




Note on Data Used
The analyses below are performed on a realistically simulated dataset that mirrors the
structure, variable types, ranges, and distributions described for the NIDS Wave 1 dataset (n = 1
200 children aged 5–17). When you run the provided R code against the actual
NIDS_WAVE1.csv file from the myUnisa Additional Resources folder, your numeric outputs
(coefficients, p-values, etc.) will differ from those shown here, but all methodology,
interpretation frameworks, and conclusions follow the same logic.



PART I

Question (a): Exploratory Data Analysis [10 marks]

R Code
# Load data
data <- read.csv("NIDS_WAVE1.csv", header=TRUE, stringsAsFactors=TRUE)


# Select analysis variables
analysis_vars <- c("Age","Gender","Race","Care_Rel","Care_Edu","Prov2011",
"Geo2011","HH_Size","GRN","HH_Income","MPI_Category","BMI")
df <- na.omit(data[, analysis_vars])


# Summary statistics
summary(df)
sapply(df[, sapply(df, is.numeric)], sd)


# Frequency tables for categorical variables
for(v in c("Gender","Race","Care_Rel","Care_Edu","Prov2011",
"Geo2011","GRN","MPI_Category")) {
print(table(df[[v]]))
print(round(prop.table(table(df[[v]])), 3))

, }


# Histogram + boxplot for BMI
par(mfrow=c(1,2))
hist(df$BMI, main="Histogram of BMI", xlab="BMI",
col="steelblue", probability=TRUE)
lines(density(df$BMI), col="red", lwd=2)
boxplot(df$BMI, main="Boxplot of BMI", ylab="BMI", col="steelblue")
par(mfrow=c(1,1))


# Boxplots of BMI by categorical predictors
boxplot(BMI ~ Gender, data=df, main="BMI by Gender",
col=c("pink","lightblue"), ylab="BMI")
boxplot(BMI ~ Race, data=df, main="BMI by Race",
col=rainbow(4), ylab="BMI", las=2)
boxplot(BMI ~ MPI_Category, data=df, main="BMI by MPI Category",
col=c("gold","orange","tomato","firebrick"), ylab="BMI", las=2)
boxplot(BMI ~ GRN, data=df, main="BMI by Social Grant",
col=c("lightgreen","salmon"), ylab="BMI")


# Scatter plots: continuous predictors vs BMI
par(mfrow=c(1,3))
plot(df$Age, df$BMI, main="BMI vs Age", pch=16, col="steelblue", cex=0.6)
abline(lm(BMI~Age, data=df), col="red", lwd=2)
plot(df$HH_Income, df$BMI, main="BMI vs HH Income", pch=16, col="seagreen",
cex=0.6)
abline(lm(BMI~HH_Income, data=df), col="red", lwd=2)
plot(df$HH_Size, df$BMI, main="BMI vs HH Size", pch=16, col="purple", cex=0.6)
abline(lm(BMI~HH_Size, data=df), col="red", lwd=2)
par(mfrow=c(1,1))



Output – Summary Statistics
Variable Min Q1 Median Mean Q3 Max SD

Age (years) 5.00 8.00 11.00 10.98 14.00 17.00 3.81

HH_Size 2.00 4.00 5.00 5.58 7.00 12.00 2.12

HH_Income (R) 3 3485 6319 6585 9315 19376 3924

BMI 10.20 15.59 17.00 16.95 18.36 23.99 2.07




Output – Frequency Tables (Categorical Variables)
Variable Category Frequency Proportion

Gender Female 615 51.2%

Gender Male 585 48.8%

Race Black African 977 81.4%

Connected book
 image
Publisher: 2019 ISBN: 9781351445856 Edition: Unknown

Document information

Uploaded on
May 17, 2026
Number of pages
16
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
R47,81

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
FocusZone
4,2
(67)
Sold
444
Followers
2
Items
631
Last sold
14 hours ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions