setwd("/Users/isaiahmireles/Desktop/Misconceptions")
# Midterm :
# F23
F23_M_VA <-
read.csv("F23_Midterm_Version_Set_Scores/Midterm_Version_A_scores.csv")
F23_M_VB <-
read.csv("F23_Midterm_Version_Set_Scores/Midterm_Version_B_scores.csv")
# W24
W24_M_VA <-
read.csv("W24_Midterm_Version_Set_Scores/Midterm_Version_A_scores.csv")
W24_M_VB <-
read.csv("W24_Midterm_Version_Set_Scores/Midterm_Version_B_scores.csv")
# S24
S24_M <-
read.csv("24S-STATS-10-LEC-4_Midterm/S24_Midterm_student_responses copy.csv")
# ------------------------------------------------------------------------------- #
# Final :
# F23
F23_F_VA <-
read.csv("F23_Final_Exam_Version_Set_Scores/Final_Exam_Version_A_scores.csv")
F23_F_VB <-
read.csv("F23_Final_Exam_Version_Set_Scores/Final_Exam_Version_B_scores.csv")
# W24
W24_F_VA <-
read.csv("W24_Final_Exam_Version_Set_Scores/Final_Exam_Version_A_scores.csv")
W24_F_VB <-
read.csv("W24_Final_Exam_Version_Set_Scores/Final_Exam_Version_B_scores.csv")
# S24
S24_F_VA <-
read.csv("S24_Final_Exam_Version_Set_Scores/Final_Exam_Version_A_scores.csv")
S24_F_VB <-
read.csv("S24_Final_Exam_Version_Set_Scores/Final_Exam_Version_B_scores.csv")n_rw <-
F23_F_VA |> nrow() + F23_F_VB |> nrow() + W24_F_VA |> nrow() + W24_F_VB |> nrow() + S24_F_VA |> nrow() + S24_F_VB |> nrow()
paste0("Sum of all Rows = ", n_rw, " rows")## [1] "Sum of all Rows = 1520 rows"
Preface :
Status=="Graded"
)## [1] "First.Name" "Last.Name"
## [3] "SID" "Email"
## [5] "Sections" "Total.Score"
## [7] "Max.Points" "Status"
## [9] "Submission.ID" "Submission.Time"
## [11] "Lateness..H.M.S." "View.Count"
## [13] "Submission.Count" "X1..Question.1..1.0.pts."
## [15] "X2..Question.2..1.0.pts." "X3..Question.3..1.0.pts."
## [1] "F23_M_VA :"
## [1] "F23_M_VB :"
As we can see in each data set theres about 150+ ungraded students
There are about 250 graded students in each
## [1] 420
## [1] 398
## [1] 301
## [1] 301
## [1] "n_F23_M_VA = 420"
## [1] 301
## [1] 301
## [1] "n_F23_M_VB = 398"
VA, B there are equal amt
SID and (First, Last) pairs (301)loss <- c(n_F23_M_VA, n_F23_M_VB) - 301
names(loss) <- c("n_F23_M_VA", "n_F23_M_VB")
paste0(names(loss)," loss = ", loss)## [1] "n_F23_M_VA loss = 119" "n_F23_M_VB loss = 97"
F23_M_VA |>
group_by(First.Name, Last.Name) |>
summarize(n_sid = n_distinct(SID)) |>
filter(n_sid != 1)F23_M_VB |>
group_by(First.Name, Last.Name) |>
summarize(n_sid = n_distinct(SID)) |>
filter(n_sid != 1)(First, Last) pair maps to one unique
SID.Do students only appear in their respective versions?
bind_rows(
F23_M_VA |> mutate(version = "A"),
F23_M_VB |> mutate(version = "B")
) |>
ungroup() |>
group_by(First.Name, Last.Name) |>
summarise(
times = n(),
version = paste(unique(version), collapse = ", "),
.groups = "drop"
) |>
filter(times > 1) |>
arrange(desc(times)) |>
mutate(
id = row_number(),
unidentified = First.Name == "unidentified" & Last.Name == "student",
First.Name = if_else(
unidentified,
"unidentified",
paste0("identity_", id - 1)
),
Last.Name = if_else(
unidentified,
"student",
"hidden"
)
) |>
select(-id, -unidentified)unidentified student (
216 Obs. )300 Obs. )Perhaps its only because non-graded are repeated in both?
bind_rows(
F23_M_VA |> filter(Status == "Graded") |> mutate(dataset = "A"),
F23_M_VB |> filter(Status == "Graded") |> mutate(dataset = "B")
) |>
group_by(First.Name, Last.Name) |>
summarise(
times = n(),
datasets = paste(unique(dataset), collapse = ", "),
.groups = "drop"
) |>
filter(times > 1)check_sid <- function(df) {
# Check whether SID column exists
if (is.null(df$SID)) {
return("SID column is NULL or does not exist")
}
df |>
mutate(idx = row_number()) |>
filter(
is.na(SID) |
trimws(as.character(SID)) == "" |
!grepl("^[0-9]+$", as.character(SID))
) |>
select(idx, SID)
}find_duplicates <- function(df) {
df |>
mutate(idx = row_number()) |>
group_by(SID) |> # grp by student id
filter(n() > 1) |>
ungroup() |>
pull(idx) # make vector
}bind_rows(
F23_F_VA |> filter(Status == "Graded") |> mutate(dataset = "A"),
F23_F_VB |> filter(Status == "Graded") |> mutate(dataset = "B")
) |>
group_by(First.Name, Last.Name) |>
summarise(
times = n(),
datasets = paste(unique(dataset), collapse = ", "),
.groups = "drop"
) |>
filter(times > 1)F23_F <- F23_F |>
left_join(
F23_M_dictionary |>
filter(!is.na(SID)) |>
distinct(SID, student_id),
by = "SID"
)# reconfigure questions
F23_M <- F23_M |>
rename_with(
~ paste0(
"Q",
sub("^X([0-9]+).*", "\\1", .x),
"_F23M"
),
matches("^X[0-9]+\\.\\.Question")
)F23_F <-
F23_F |>
rename_with(
~ paste0(
"Q",
sub("^X([0-9]+).*", "\\1", .x),
"_F23F"
),
matches("^X[0-9]+\\.\\.Question")
)So the final has 31Qs and Midterm has 34, so im checking what those values become :
W24_M_VA <- W24_M_VA |>
filter(Status == "Graded") |>
mutate(version = "A", exam = "Midterm", term = "W24")
W24_M_VB <- W24_M_VB |>
filter(Status == "Graded") |>
mutate(version = "B", exam = "Midterm", term = "W24")## [1] 297
## [1] 297
## integer(0)
## function (df)
## {
## pull(ungroup(filter(group_by(mutate(df, idx = row_number()),
## SID), n() > 1)), idx)
## }
## <bytecode: 0x10944aae0>
W24_M <-
W24_M |>
select(student_id, everything(),
-c(
SID,
Submission.ID,
First.Name,
Last.Name,
Email,
Lateness..H.M.S.,
Submission.Time,
View.Count,
Submission.Count
)) W24_M <-
W24_M |>
rename_with(
~ paste0(
"Q",
sub("^X([0-9]+).*", "\\1", .x)
),
matches("^X[0-9]+\\.\\.Question")
)W24_F_VA <-
W24_F_VA |>
filter(Status == "Graded") |>
mutate(version = "A", exam = "Final", term = "W24")
W24_F_VB <-
W24_F_VB |>
filter(Status == "Graded") |>
mutate(version = "B", exam = "Final", term = "W24")## integer(0)
W24_F <-
W24_F |>
select(
student_id,
everything(),
-c(
Status,
SID,
Submission.ID,
First.Name,
Last.Name,
Email,
Lateness..H.M.S.,
Submission.Time,
View.Count,
Submission.Count
)
) |>
rename_with(
~ paste0(
"Q",
sub("^X([0-9]+).*", "\\1", .x)
),
matches("^X[0-9]+\\.\\.Question")
)bind_rows(F23, W24) |>
filter(is.na(unidentified)) |>
mutate(
student_id_type = grepl("^student_[0-9]+$", student_id)
) |>
count(student_id_type)unfortunately this one doesnt fit the same pattern of col-names so coding is difficult
However note the ability to view typical student responses
Notice the richness of the data :
## [1] "Question.1.Score" "Question.1.Weight"
## [3] "Question.1.Student.Response.s." "Question.1.Correct.Response"
We may therefore have multiple data sets for different modeling purposes – we may compare the performance of each to better understand what better predicts the performance of student on the most recent final exam.
Binary Data Set
Binary & MCQ Data Set
Binary & Text Embedding (Classification)
Binary & MCQ Data Set & Text Embedding (Classification)
## [1] "First.Name" "Last.Name" "Student.ID" "Email"
## [5] "Sections" "Status" "Submission.ID" "Max.Points"
## [9] "Total.Score" "Q1" "Q2" "Q3"
## [13] "Q4" "Q5" "Q6" "Q7"
## [17] "Q8" "Q9" "Q10" "Q11"
## [21] "Q12" "Q13" "Q14" "Q15"
## [25] "Q16" "Q17" "Q18" "Q19"
## [29] "Q20" "Q21" "Q22" "Q23"
## [33] "Q24" "Q25" "Q26" "Q27"
## [37] "Q28" "Q29" "Q30" "Q31"
## [41] "Q32" "Q33" "Q34"
## [1] 149
## [1] 149
## [1] 149
## [1] 149
S24_M <- S24_M |>
mutate(unidentified = FALSE) |>
rename(SID=Student.ID)
S24_M <-
S24_M |>
mutate(
student_id = if_else(
unidentified,
paste0("unidentified_", cumsum(unidentified)),
paste0(
"student_",
match(SID, unique(SID[!is.na(SID)]))
)
)
)S24_M <-
S24_M |>
select(
everything(),
-c(1:4),
-c(Status, Submission.ID)
) |>
select(
unidentified,
term,
exam,
version,
student_id,
Sections,
Total.Score,
Max.Points,
Q1:Q34
)S24_F <-
bind_rows(
S24_F_VA |> mutate(version = "A", exam = "Final", term = "S24") |> filter(Status=="Graded"),
S24_F_VB |> mutate(version = "B", exam = "Final", term = "S24") |> filter(Status=="Graded")
)cohorts |>
ggplot(aes(x = pct, color = term)) +
geom_density(linewidth = 1) +
facet_wrap(~ exam) +
labs(
x = "Percent Score",
y = "Density",
color = "Term"
)cohort_pairs <- cohorts |>
filter(exam %in% c("Midterm", "Final")) |>
select(term, student_id, exam, pct) |>
pivot_wider(
names_from = exam,
values_from = pct
)cohort_pairs |>
add_count(term, Midterm, Final, name = "density") |>
ggplot(aes(x = Midterm, y = Final, color = density)) +
geom_point(alpha = 0.7) +
facet_wrap(~ term) +
scale_x_continuous(labels = scales::percent) +
scale_y_continuous(labels = scales::percent) +
labs(
x = "Midterm Percent",
y = "Final Percent",
color = "Students",
title = "Midterm vs. Final Performance by Quarter"
)## Warning: Removed 230 rows containing missing values or values outside the scale range
## (`geom_point()`).
Pressure Test Data (Conversation History)