Lab Assignment 5 Instructions

In this assignment, you will use data from the Midterm Exam in the Fall Semester of 2023. The data file is named “Data205_2023Fall_Midterm.csv” as you can see in this RStudio Cloud project. There are two variables in this data set.

The “lab” variable shows which DATA 205 Lab each student is attending. There are three labs: A, B, and D.

The “midterm” variable shows each student’s midterm exam score, which has been rescaled between 0 to 100 points.

Here is the R code to import the data:

df <- read.csv("Data205_2023Fall_Midterm.csv")

Exercise 1 (6 Points):

Write R code below to find out:

  1. the number of students who took the midterm exam; (2 points)
  2. the mean of the exam scores; (2 points)
  3. the median of the exam scores. (2 points)

Note that in addition to show your R code and output, you also need to explicitly report the number of students, the mean, and the median in words/text. Otherwise, you will only receive partial credits.

## Start your R code in the next line
summary(df)
##      lab               midterm     
##  Length:58          Min.   :20.00  
##  Class :character   1st Qu.:47.75  
##  Mode  :character   Median :57.00  
##                     Mean   :56.40  
##                     3rd Qu.:63.00  
##                     Max.   :87.00
  1. 58 students took the midterm exam (Seen in Length in code above)
  2. The mean of the exam scores is 56.40.
  3. The median of the exam scores is 57.

Exercise 2 (2 Points):

Write R code here to create a histogram of the exam scores.

## Start your R code in the next line
hist(df$midterm,
     main = "Midterm Score Distribution",
     xlab = "Midterm Scores")

Exercise 3 (4 Points):

Write R code to create boxplots of the midterm scores for students in different Labs (2 points).

## Start your R code in the next line
boxplot(midterm ~ lab, data = df,
        xlab = "Lab Section",
        ylab = "Midterm Scores",
        col = c("blue", "magenta", "green"))

Based on the boxplots, do you think whether or not there is any difference in students’ midterm exam scores across the three Labs? (2 point).

I believe that there is a difference in students midterm exam scores across the 3 labs because looking at the boxplots we can see that Lab D has the highest median score given by the line in the middle of the boxplot. Lab B also appears to have the least variance in exam scores judging by the size of the box and whiskers.

Submitting Your Assignment

Please knit your Markdown document into a HTML file and publish it on RPubs (see Lab 5 slides), and submit the link to your published webpage on the Blackboard.