Comparing Grades Between Online and In-Person Stat 100 Classes

Use this RMarkdown template for this exercise.

Stat 100 is one of the most popular courses at U of I. There are about 1500 students every semester. Starting from Fall 2016, three sections of Stat 100 classes (L1, L2 and online) are synchronized. The L1 and L2 sections were in-person classes taught by the same instructor and students had to attend the lectures at the Lincoln Hall Theater. In Spring 2017, L1 classes were on Mondays, Wednesdays and Fridays from 12:00pm to 12:50pm; L2 classes were on Tuesdays and Thursdays from 11:00am to 12:20pm. Students in the online section did not have to go to class. Students in all three sections were given the exact same lectures, homework assignments, bonus assignments, and exams. They also had the same TAs and office hours. The only difference between the online and in-person classes was that students in the online class watched videos recorded from the L2 lectures. Each lecture video was usually available for the online students within two hours after the L2 class ended.

In this exercise, you are going to analyze the scores of the Stat 100 students in Spring 2017 and see if there is any significant difference between the online and in-person sections. The data can be downloaded here. The file has the following 8 columns:

Availability: Yes/No indicating whether the student was still enrolled in the class at the end of the semester.

Section: STAT_100_L1 is L1 section; STAT_100_L2 is L2 section; STAT_100_ONL is online section.

Bonus: Total bonus points

HWavg: Average homework score (lowest 3 dropped)

Exam1: Exam 1 score

Exam2: Exam 2 score

Exam3: Exam 3 score

Final: Final Exam score

Note: all scores range from 0 to 100 (theoretically), although sometimes extra bonus points may be awarded to students.

Data cleaning: It is often said that in a typical data analysis project, 90% of the time is spent in cleaning data and transform them into a format suitable for analysis. There is also a joke that 80 percent of data science is cleaning the data and 20 percent is complaining about cleaning the data. Real-world data are messy with many missing values. In this course, we don't deal with dirty data. The data in this exercise, however, are slightly unclean but they can be cleaned with only two lines of R code.

After loading the data to R, you should take some time to explore the data before attempting the following questions. If you use read.csv() command to load the data without specifying any other options, you will see missing values in your data frame. Pay attention to the locations of the missing values. Open the csv file in, e.g. Excel and look at the locations of the missing values. When you are done exploring the data, answer the following questions.

Hint: All of the questions below that are worth 1 point can be done with one line of R code, and none of the questions requires more than 5 lines of R code. If you find yourself writing a long code (e.g. more than 10 lines) for any one question, you are either not going in the right direction or not taking advantage of R's vectorized operations.

  1. (1 point) Some students dropped the course and we don't want to include them in the data. Remove the dropped students (Availability = No) from the data frame.

  2. (1 point) If you investigate the origin of the missing values, you will find that they correspond to the blank fields in the exam scores. When a student did not take an exam, there is no score and the field is blank. So the exam score should be 0. Replace all the missing values by 0. (Hint: You only need a one-line R code. You've seen this code in Week 5's exercise on calculating HW grades.)

  3. (1 point) How many students are there in each of the L1, L2 and online section? (Hint: You've done this in your very first RMarkdown exercise. You only need to use a single R command.)


  4. To determine if there is any difference between the online and in-person sections, we are going to make three comparisons:

    • Compare the two group's performance on the exams.
    • Compare the two group's weighted total scores by including the HW scores.
    • Compare the two group's letter grades.

  5. (1 point) There were 3 midterm exams and one final exam. Each of the 3 exams counted 20% and the final was 25%. Compute the weighted average of the exam scores according to the formula [20×(Exam1 + Exam2 + Exam3) + 25×Final]/85 and store it in a new column of the data frame.

  6. (5 points) Make a density plot of the weighted average exam score for the in-person sections. Then add a density plot of the weighted average exam score for the online section on the same graph. In other words, your graph should have two lines: one for the combined L1 and L2 sections and the other for the online section. Use two different colors for the lines. Explain your color code (i.e. which color represents in-person sections and which represents the online section) in either a figure legend (preferred) or a figure caption. (Hint: See Week 10's notes. Many of you have also made similar plots in Week 10's RMarkdown assignment.)

  7. (4 points) Use the summary() function to calculate the mean and quartiles of the weighted average exam score for the in-person (L1 and L2 combined) and online sections. Based on the result, which section performs better on the exams?

  8. (4 points) Perform a Wilcoxon test to determine if the observed difference between the two groups is significant at α=5%. Note: You should treat L1 and L2 sections as one group and the online section as another group.

  9. (1 point) Homework counts 15%, each of the 3 exams counts 20% and final exam counts 25% of the total grade. Bonus points will be added later. Calculate the weighted total according to the formula
    weighted total = 0.15×HWavg + 0.20×(Exam1 + Exam2 + Exam3) + 0.25×Final
    and store the result in a new column of the data frame.

  10. (5 point) Make a density plot of the weighted total for the in-person sections. Then add a density plot of the weighted total for the online section on the same graph. Use two different colors for the lines and explain your color code.

  11. (4 points) Use the summary() function to calculate the mean and quartiles of the weighted total for the in-person (L1 and L2 combined) and online sections. Based on the result, which section performs better?

  12. (4 points) Perform a Wilcoxon test on the weighted total between the in-person and online sections. Is there significant difference between the in-person and online sections?

  13. (2 points) Now add the bonus points to the weighted total according to the formula stated on the Stat 100 Grading webpage:
    weighted total with bonus = (weighted total + 0.25*Bonus)/(100 + 0.25*Bonus) * 100.
    The final factor of 100 is to make the maximum possible score equal to 100 instead of 1. Round the scores to 2 decimal places and store the result in a new column of the data frame.

  14. (7 points) Based on the weighted total (with bonus) and the letter grade table below (copied from the Stat 100 Grading webpage), assign letter grades to the students and store the result in a new column of the data frame. There are many ways to do this, some good and some bad. This is your last assignment and we really want you to use a good method. Read this page, where you will see a comparison of three methods.
  15. A+ 97-100 A 93-96.99 A- 90-92.99
    B+ 87-89.99 B 83-86.99 B- 80-82.99
    C+ 77-79.99 C 73-76.99 C- 70-72.99
    D+ 67-69.99 D 63-66.99 D- 60-62.99
    F < 60

  16. (3 points) Consistency check. What is the percentage of students who get A or A+? Do it in two ways: (1) by counting the percentage of students with weighted total (with bonus) ≥ 93; (2) by counting the percentage of A and A+ in the column you created in the previous question. Make sure the two methods give the same result.

  17. (3 points) Make a barplot showing the percentage of students in each letter grade.


  18. The final comparison is to see if there is significant difference on the letter grades between the online and in-person sections. Since letter grades are categories, we will need to do a χ2 independence test. If you do that, you will get a warning message. This is because the χ2 test is inaccurate for small values of expected frequencies. If you look into the problem, you will find that the small expected values occur for the letter grades D- and D. One method to solve this problem is pooling: combining categories of small expected values. The following code combines the letter grades D-, D and D+ to D:

    pooled <- as.character(stat100$grade)
    pooled[pooled=="D-" | pooled=="D+"] <- "D"

    Here it is assumed that 'stat100$grade' is a factor vector that stores the students' letter grades. You will need to change the code to match your variable name. You can verify using the command table(pooled) that the D+, D and D- grades are combined to the D grade.


  19. (4 points) Perform a χ2 independence test to determine if there is significant difference on the pooled letter grades stored in 'pooled' between students in the in-person and online sections.

Guidelines


Solution