Converts student-level data and input matrices into the list expected by
prepare_phd_model().
Arguments
- student_df
A data frame with one row per student. Required columns are:
student_id,year,past_ta, andpast_gr. Note that it has to be in this order and name.yearis capped to 1-4.- p_mat
Preference matrix with dimensions
Ns x Nj. Row order must matchstudent_dfrow order.- d_mat
Demand matrix with dimensions
Nj x 2orNj x 3. Columns are interpreted in order asTA,GR, and optionalE. Row order must match the column order ofp_mat.- e_mode
How to handle E demand when
d_matdoes not include E."rr"computes E using round-robin allocation from highest to lowest GR demand;"none"leaves E at 0.- C
Semester workload capacity per student. Used when
e_mode = "rr"to compute total semester capacity asNs * C.- s
Numeric vector containing the E-allocation scores for Years 1, 2, 3, and 4, respectively. Larger scores make E units more attractive for that year when
phi > 0inprepare_phd_model(). Defaults toc(-1, 0, 1, 2).
Value
A list containing:
Ns: number of studentsNj: number of coursesP: preference matrix (Ns x Nj)d: demand matrix (Nj x 3) with columnsTA,GR,Es: student-level E-allocation score vectoryear: capped year-of-study vectort1: past TA workload vectorg1: past GR workload vector
Details
This function assumes input order is already aligned:
student_dfrowicorresponds toP[i, ],s[i],t1[i], andg1[i].d_matrowjcorresponds toP[, j].
p_mat is used as supplied, so users can choose any numeric preference
scoring scheme during preprocessing.
If E is computed (e_mode = "rr"), total E is set to:
Ns * C - sum(TA) - sum(GR).
Examples
default_scores <- extract_phd_info(
student_df = multirole_students_ex001,
p_mat = multirole_prefmat_ex001,
d_mat = multirole_demand_ex001,
e_mode = "none"
)
custom_scores <- extract_phd_info(
student_df = multirole_students_ex001,
p_mat = multirole_prefmat_ex001,
d_mat = multirole_demand_ex001,
e_mode = "none",
s = c(0, 1, 3, 6)
)
custom_scores$s
#> [1] 0 1 3 6