Background :

This data is of the midterm performance of students spring 2024 on the Stats 10 Midterm. There are a total of 34 questions, Sample size (n = 155).

Research Question :

  • Is there evidence to suggest 3 latent variables (Regression, Design & Probability) structure to the performance of students

Read in Data :

rm(list=ls())
df <- read.csv("/Users/isaiahmireles/Desktop/Misconceptions/24S-STATS-10-LEC-4_Midterm/S24_Midterm_student_responses copy.csv")
library(tidyverse)

Anonymization :

df$Student.ID <- paste0("Student", seq_len(nrow(df)))
df <- df |> select(-c(First.Name, Last.Name, Email))

Data Basics :

Population : Spring 2024, Stats 10 MCQ Midterm

df$Total.Score <- as.numeric(df$Total.Score)
s2 <- sd(df$Total.Score, na.rm = T)
ybar <- mean(df$Total.Score, na.rm=T)


grd_hist_plt <-
  df |>
  ggplot(aes(x = Total.Score)) +
  geom_histogram(
    aes(y = after_stat(density)),
    bins = 12,
    fill = "lightblue",
    color = "black"
  ) +
  stat_function(
    fun = dnorm,
    args = list(mean = ybar, sd = s2),
    color = "blue",
    linewidth = 1.2
  ) +
  labs(
    title = "Hist of Exam Performance",
    x = "Total Score",
    y = "Density"
  )

box_plt <-
  df |>
  ggplot(aes(x = Total.Score)) +
  geom_boxplot(fill = "lightblue", color = "black") +
  labs(
    title = "Boxplot of Exam Performance",
    x = "Total Score"
  )

library(patchwork)
grd_hist_plt/box_plt

  • Histogram Displays heavy right skew

  • Normal dist displays a moderate fit

Pct Performance :

df$Max.Points <- as.numeric(df$Max.Points)
## Warning: NAs introduced by coercion
performance_df <-
  df |> 
  mutate(pct = round( Total.Score/Max.Points, 3)) |> 
  select(Total.Score, pct) |> 
  arrange(desc(pct)) |> 
  mutate(passed = if_else(pct >= .7, 1, 0))

passed_failed_bar_plt <-
  performance_df |>
  filter(!is.na(passed)) |>
  mutate(
    passed_label = factor(
      if_else(passed == 1, "Passed", "Failed"),
      levels = c("Failed", "Passed")
    )
  ) |>
  count(passed_label) |>
  mutate(
    percent = n / sum(n)
  ) |>
  ggplot(aes(x = passed_label, y = percent, fill = passed_label)) +
  geom_col() +
  scale_fill_manual(
    values = c("Failed" = "red", "Passed" = "green")
  ) +
  scale_y_continuous(labels = scales::percent) +
  labs(
    title = "Percent Passed vs Failed",
    x = "",
    y = "Percent"
  )

passed_failed_bar_plt

summary(performance_df$passed) # 0.7248 pct passed 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##  0.0000  0.0000  1.0000  0.7248  1.0000  1.0000       6
summary(performance_df$Total.Score) # 26.33
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
##   13.00   23.00   27.00   26.33   30.00   34.00       6

Correlations

Notice that our data is not continuous so we cannot use our typical correlation (pearsons’ correlation); but rather the binary version : Tetrachoric Correlation.

binary <-
  df |> 
  select(ends_with("Score")) |> 
  select(-Total.Score)

library(psych)
tetrachoric(binary)
## Warning in cor.smooth(mat): Matrix was not positive definite, smoothing was
## done
## Call: tetrachoric(x = binary)
## tetrachoric correlation 
##                   Q.1.S Q.2.S Q.3.S Q.4.S Q.5.S Q.6.S Q.7.S Q.8.S Q.9.S Q.10.
## Question.1.Score   1.00                                                      
## Question.2.Score   0.50  1.00                                                
## Question.3.Score   0.20  0.52  1.00                                          
## Question.4.Score   0.15 -0.05  0.02  1.00                                    
## Question.5.Score   0.03  0.27  0.16 -0.10  1.00                              
## Question.6.Score  -0.08  0.11  0.39 -0.12  0.31  1.00                        
## Question.7.Score   0.52  0.31  0.24  0.00  0.19  0.36  1.00                  
## Question.8.Score   0.21  0.23  0.28  0.26  0.20  0.03  0.23  1.00            
## Question.9.Score   0.18  0.42  0.30  0.16  0.18  0.15  0.36  0.28  1.00      
## Question.10.Score  0.35  0.50  0.52  0.36  0.25  0.12  0.11  0.40  0.48  1.00
## Question.11.Score  0.12  0.19  0.14  0.03  0.30  0.09  0.36  0.43  0.49  0.27
## Question.12.Score  0.19  0.30  0.16  0.22  0.17  0.23  0.15  0.34  0.39  0.42
## Question.13.Score -0.04 -0.01  0.33  0.47  0.07  0.39  0.13  0.26  0.09  0.19
## Question.14.Score  0.01  0.25  0.27  0.02  0.25  0.18  0.12  0.23  0.35  0.05
## Question.15.Score  0.02 -0.09  0.05  0.05  0.02  0.24  0.33 -0.05 -0.01 -0.15
## Question.16.Score  0.20  0.15 -0.09  0.15  0.05  0.06  0.18  0.20  0.53  0.24
## Question.17.Score  0.24  0.30  0.09  0.40 -0.12 -0.03  0.17  0.31  0.14  0.29
## Question.18.Score -0.04 -0.03  0.37  0.35  0.26  0.22  0.03  0.37  0.27  0.36
## Question.19.Score  0.19 -0.08  0.22  0.31  0.30  0.23  0.13  0.29  0.18  0.25
## Question.20.Score  0.14  0.14  0.29  0.27  0.43  0.23  0.31  0.53  0.49  0.49
## Question.21.Score -0.12  0.13  0.21  0.29  0.48  0.12 -0.07  0.11  0.06  0.25
## Question.22.Score  0.05  0.32  0.02  0.01  0.09 -0.13  0.11  0.08  0.07  0.00
## Question.23.Score  0.13  0.07  0.34  0.26  0.30  0.42 -0.09  0.19  0.00  0.34
## Question.24.Score  0.32  0.17  0.21 -0.28  0.15  0.02  0.09 -0.12  0.10 -0.01
## Question.25.Score  0.04 -0.06  0.27  0.10  0.22  0.41  0.36  0.32  0.22  0.22
## Question.26.Score -0.12  0.15  0.15 -0.14  0.46  0.33  0.14  0.16  0.23  0.17
## Question.27.Score -0.04  0.24  0.44  0.15  0.44  0.63  0.31  0.31  0.53  0.50
## Question.28.Score  0.30  0.23  0.32  0.29  0.18  0.02  0.01  0.06  0.16  0.45
## Question.29.Score -0.07  0.16  0.25  0.18  0.06  0.46  0.13  0.05  0.36  0.32
## Question.30.Score  0.32  0.52  0.36  0.22  0.08  0.12  0.16  0.31  0.27  0.47
## Question.31.Score  0.30  0.31  0.32  0.07  0.38  0.31  0.23  0.54  0.23  0.39
## Question.32.Score  0.31  0.22 -0.12  0.05  0.09  0.20  0.18  0.04 -0.04  0.25
## Question.33.Score  0.18  0.29  0.07  0.17  0.35  0.35  0.05  0.03  0.18  0.34
## Question.34.Score  0.05  0.28  0.20  0.23  0.23  0.21 -0.01  0.22  0.01  0.37
##                   Q.11.
## Question.1.Score       
## Question.2.Score       
## Question.3.Score       
## Question.4.Score       
## Question.5.Score       
## Question.6.Score       
## Question.7.Score       
## Question.8.Score       
## Question.9.Score       
## Question.10.Score      
## Question.11.Score  1.00
## Question.12.Score  0.40
## Question.13.Score  0.23
## Question.14.Score  0.33
## Question.15.Score -0.06
## Question.16.Score  0.47
## Question.17.Score  0.09
## Question.18.Score  0.26
## Question.19.Score  0.19
## Question.20.Score  0.48
## Question.21.Score  0.24
## Question.22.Score -0.14
## Question.23.Score -0.02
## Question.24.Score  0.14
## Question.25.Score  0.18
## Question.26.Score  0.42
## Question.27.Score  0.15
## Question.28.Score -0.09
## Question.29.Score  0.14
## Question.30.Score  0.03
## Question.31.Score  0.07
## Question.32.Score -0.06
## Question.33.Score -0.16
## Question.34.Score  0.20
##                   Q.12. Q.13. Q.14. Q.15. Q.16. Q.17. Q.18. Q.19. Q.20. Q.21.
## Question.12.Score  1.00                                                      
## Question.13.Score  0.45  1.00                                                
## Question.14.Score  0.16  0.13  1.00                                          
## Question.15.Score  0.13  0.25  0.33  1.00                                    
## Question.16.Score  0.47  0.21  0.08  0.05  1.00                              
## Question.17.Score  0.41 -0.07  0.12 -0.03 -0.08  1.00                        
## Question.18.Score  0.28  0.38 -0.05  0.07  0.36  0.04  1.00                  
## Question.19.Score  0.36  0.43 -0.01 -0.08  0.41  0.13  0.66  1.00            
## Question.20.Score  0.51  0.49  0.06 -0.07  0.48  0.10  0.65  0.73  1.00      
## Question.21.Score  0.34  0.34  0.22  0.04  0.27  0.01  0.39  0.27  0.21  1.00
## Question.22.Score  0.35 -0.02  0.20  0.08  0.20  0.26 -0.19  0.09  0.11  0.15
## Question.23.Score  0.31  0.43  0.34  0.13  0.14  0.03  0.34  0.36  0.32  0.43
## Question.24.Score -0.06 -0.22  0.27  0.05  0.22 -0.21  0.02  0.04  0.01  0.12
## Question.25.Score  0.30  0.38  0.13  0.13  0.11  0.04  0.38  0.48  0.56  0.09
## Question.26.Score  0.01  0.12 -0.05 -0.18  0.31 -0.17  0.22  0.26  0.40  0.04
## Question.27.Score  0.23  0.31  0.29  0.14  0.13  0.08  0.45  0.33  0.46  0.20
## Question.28.Score -0.07 -0.02  0.08  0.07  0.24 -0.06  0.42  0.32  0.08  0.23
## Question.29.Score  0.44  0.16  0.23  0.13  0.27  0.22  0.06  0.06  0.06  0.27
## Question.30.Score  0.16 -0.19  0.21 -0.25 -0.03  0.63  0.20  0.17  0.02  0.17
## Question.31.Score  0.32  0.17  0.09  0.07  0.30 -0.02  0.37  0.25  0.38  0.33
## Question.32.Score  0.24  0.10  0.03  0.22  0.27  0.20  0.07  0.22  0.12 -0.02
## Question.33.Score  0.35  0.25  0.05  0.33  0.27  0.21  0.31  0.40  0.30  0.20
## Question.34.Score  0.44  0.20  0.06  0.07  0.05  0.39  0.34  0.16  0.28  0.27
##                   Q.22.
## Question.12.Score      
## Question.13.Score      
## Question.14.Score      
## Question.15.Score      
## Question.16.Score      
## Question.17.Score      
## Question.18.Score      
## Question.19.Score      
## Question.20.Score      
## Question.21.Score      
## Question.22.Score  1.00
## Question.23.Score  0.01
## Question.24.Score  0.02
## Question.25.Score  0.01
## Question.26.Score -0.04
## Question.27.Score -0.11
## Question.28.Score  0.11
## Question.29.Score  0.17
## Question.30.Score  0.14
## Question.31.Score  0.02
## Question.32.Score  0.08
## Question.33.Score  0.14
## Question.34.Score -0.09
##                   Q.23. Q.24. Q.25. Q.26. Q.27. Q.28. Q.29. Q.30. Q.31. Q.32.
## Question.23.Score  1.00                                                      
## Question.24.Score  0.03  1.00                                                
## Question.25.Score  0.24 -0.15  1.00                                          
## Question.26.Score  0.04 -0.10  0.19  1.00                                    
## Question.27.Score  0.34 -0.20  0.38  0.33  1.00                              
## Question.28.Score  0.19  0.18  0.01  0.13  0.33  1.00                        
## Question.29.Score  0.29 -0.18  0.46  0.26  0.36  0.15  1.00                  
## Question.30.Score  0.14 -0.12  0.05 -0.08  0.45  0.44  0.27  1.00            
## Question.31.Score  0.42  0.04  0.30  0.25  0.54  0.26  0.31  0.30  1.00      
## Question.32.Score  0.30 -0.28  0.23  0.11  0.33  0.24  0.21  0.32  0.30  1.00
## Question.33.Score  0.38 -0.09  0.37  0.18  0.36  0.30  0.30  0.16  0.24  0.58
## Question.34.Score  0.11  0.00  0.30  0.19  0.27  0.05  0.32  0.25  0.41  0.30
##                   Q.33.
## Question.23.Score      
## Question.24.Score      
## Question.25.Score      
## Question.26.Score      
## Question.27.Score      
## Question.28.Score      
## Question.29.Score      
## Question.30.Score      
## Question.31.Score      
## Question.32.Score      
## Question.33.Score  1.00
## Question.34.Score  0.32
## [1]  1.00
## 
##  with tau of 
##  Question.1.Score  Question.2.Score  Question.3.Score  Question.4.Score 
##            -1.675            -1.748            -1.498             0.093 
##  Question.5.Score  Question.6.Score  Question.7.Score  Question.8.Score 
##             0.212            -0.299            -2.214            -0.597 
##  Question.9.Score Question.10.Score Question.11.Score Question.12.Score 
##            -1.929            -0.246            -1.929            -1.107 
## Question.13.Score Question.14.Score Question.15.Score Question.16.Score 
##            -1.358            -1.047            -1.107            -1.401 
## Question.17.Score Question.18.Score Question.19.Score Question.20.Score 
##            -1.551            -0.861            -1.107            -1.831 
## Question.21.Score Question.22.Score Question.23.Score Question.24.Score 
##            -0.723             0.519            -0.558            -0.281 
## Question.25.Score Question.26.Score Question.27.Score Question.28.Score 
##            -1.171            -1.241            -0.937            -0.937 
## Question.29.Score Question.30.Score Question.31.Score Question.32.Score 
##            -0.352            -1.317            -0.659            -0.519 
## Question.33.Score Question.34.Score 
##             0.042             0.110