I am trying to study attrition amongst students during their 3 year bachelor's degree. If I measure values of various features every semester over a 3 year period (or any other frequency), only some features change over time, some don't. The student profile data such as what their Year 12 score was or if they are first in family to attend Uni doesn't change over time. But GPA, the number of units they enroll themselves in etc. changes with time. How can I handle this in Survival Analysis ? How can I account for the fact that the first 3 rows belong to 1 student and the next 2 to another student.

Note: It's more important for me to take into account the impact of changing values of some features on attrition (such as how study load went from 4 to 3 to 2) than to know at what point in their course they quit - which is good to know as well. Holistically considering the change in values of some features if it has resulted in attrition is what I want to know. If I do a binary classification, I am only considering a snapshot in time because I can have only 1 row per student but not the entire student experience.

Student   Year GPA    Year12-score First-in-family  Age Study-Load  Attrition
S1        Y1     4.5    78%             Yes          20  4           No 
S1        Y2     6.2    78%             Yes          21  3           No 
S1        Y3     6.1    78%             Yes          22  2           Yes
S2        Y1     8.2    82%             No           19  2           No
S2        Y2     6.9    82%             No           20  2           Yes

Also, given the fact that Student S1 attrited in Year 3, should I mark the Attrition Label as "Yes" for all 3 years ?


This calls for analysis with time-varying covariates. The survival-analysis approach to this situation is covered by a vignette for the R survival package. You code each row of data with the Student ID of the individual,* the start time and stop times for a period of interest, whether the event occurred by the end of that time period, and the covariate values in place at the start of the time period (whether different from the previous time-period values or not). The event is modeled as depending on the covariate values in place just before the event time. (Don't fall into the trap of including covariates that change because of the event.)

If your data only include yearly values, you might better treat this as a discrete-time survival model, a binomial (e.g., logistic) model that includes the Year covariate as a fixed effect along with your other covariates.** That way you have one row of data for each individual for each year, along with the values of the time-dependent covariates for that year. As in the survival analysis, you set the binary Attrition marker to "Yes" only for the year when it happened.

*If there is only 1 event possible per student, then the ID isn't strictly necessary. It's critical if your model allows for a student to quit, return, and quit again; then you need to take into account the intra-individual correlations of the tendency to quit.

**Most survival analysis implemented by the R survival package assumes that time is continuous, so that ideally only 1 event only happens as any particular time. Although there are ways to deal with tied event times, if there are just a few time periods binomial modeling with Year as a fixed-effect predictor would be preferred.

  • $\begingroup$ Thank You. For the sake of simplicity, I am going to assume that a student drops out of the course only once during the period of observation i.e. the event happens only once. $\endgroup$ – learner Mar 31 at 13:25
  • $\begingroup$ With respect to your suggestion on discrete-time survival model, doesn't it defeat the intention of wanting to study the holistic change in values of a feature over time? I realized it might be a mistake to label the student as having Attrited in a specific year. I should treat him/her as an Attrite for all rows. $\endgroup$ – learner Mar 31 at 13:31
  • $\begingroup$ Would you suggest a mixed effects logistic regression model if the time to event is not important but the occurrence of the event itself ? $\endgroup$ – learner Mar 31 at 13:53
  • 1
    $\begingroup$ @learner Both approaches assume that the probability of the event is associated with current values of covariates. You thus should NOT label a student as "attrited" except for the time period of the event. That way, the lack of an event at previous times models the (lack of) association of previous covariate values with the event. With only 1 event per student, treating students as random effects doesn't gain you anything. See the end of Section 2 of the time-dependent survival vignette linked in the answer. $\endgroup$ – EdM Mar 31 at 14:16
  • 1
    $\begingroup$ @learner To expand a bit on random effects: including random effects allows you to model differences among members of the population in terms of event probability beyond what is accounted for by their observed covariate values. That would be called a "frailty" model, with extensive literature. In practice, frailty models require special care in specifying the model and can require more extensive data. With a single event per individual, you don't need to include random effects for proper inference on the population-level associations of observed covariates with outcome. $\endgroup$ – EdM Mar 31 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.