A student survey was conducted at a major university. Data were collected from a random sample of 239 undergraduate students, and the information that was collected included physical characteristics (such as height, handedness, etc.), study habits, academic performance and attitudes, and social behaviors. In this report, I will focus on exploring relationships between some of those variables.
The data observes individual undergrads, and contains the following variables:
load("body_image.RData")
x<-data
head(x)
## Gender Height GPA HS_GPA Seat WtFeel Cheat
## 1 Female 64 2.60 2.63 M AboutRt No
## 2 Male 69 2.70 3.72 M AboutRt No
## 3 Female 66 3.00 3.44 F AboutRt No
## 4 Female 63 3.11 2.73 F AboutRt No
## 5 Male 72 3.40 2.35 B OverWt No
## 6 Female 67 3.43 3.84 M AboutRt No
q1 <- x[,c(3,4)]
q1 <- na.omit(q1)
r <- cor(q1$HS_GPA, q1$GPA, use="c")
plot(q1$HS_GPA, q1$GPA, main="High School vs College GPA", xlab="HS GPA", ylab="College GPA", pch=19, cex=.5)
l = lm(q1$GPA~q1$HS_GPA)
abline(l, col="red")
cf=coefficients(l);
text(2, 4.1, paste("GPA = ",round(cf[1],2),"+",round(cf[2],2),"HS_GPA"), col="red")
text(1.8, 3.85, paste("r = ", round(r,3)))
rect(1.45, 4.35, 2.6, 3.65)
We see that there exists a moderately strong, positive linear relationship between high school GPA and college GPA. Although college GPAs are generally a bit lower (as is likely the result of increased difficulty and less, if any >4.0 weighting), high school GPA proves to be a decent predictor of college performance.
# remove NA values
q2 <- x[,c(1,6)]
q2 <-na.omit(q2)
tbl = table(data.frame(q2$Gender, q2$WtFeel), dnn=c("Gender", "Body Image"))
colnames(tbl)<-c("About Right", "Overweight", "Underweight")
tbl
## Body Image
## Gender About Right Overweight Underweight
## Female 107 32 6
## Male 56 15 13
colnames(tbl)<-c("% About Right", "% Overweight", "% Underweight")
round(100*tbl/rowSums(tbl))
## Body Image
## Gender % About Right % Overweight % Underweight
## Female 74 22 4
## Male 67 18 15
Around 66% of men and 74% of women feel that their weight is about right. When looking at the proportions of each, who feel some sort of dissatisfaction, we see that a higher percentage of women feel overweight (22% vs 18%), and far more men feel underweight than women (15% vs 4%).