![](https://d3ilqtpdwi981i.cloudfront.net/j_FSJ_naTtZSoonh_nZT8FeBq5s=/425x550/smart/https://bepress-attached-resources.s3.amazonaws.com/uploads/c2/77/f6/c277f6de-585d-4487-9b92-2d71c3caa13a/thumbnail_bd2200ac-fbe6-4a54-9ed0-7deec43e4f45.jpg)
We consider the question of how to predict whether a student is on or off task while working on a computer programming assignment using elapsed time since the last keystroke as the single independent variable. In this paper we report results of an empirical study in which we intermittently prompted CS1 students working on a programming assignment to self-report whether they were engaged in the assignment at that moment. Our regression model derived from the results of the study shows power-law decay in the engagement rate of students with increasing time of keyboard inactivity ranging from a nearly 80% engagement rate after 45 seconds to 30% after 32 minutes of inactivity. We find that students remain engaged in programming for a median of about 8 minutes before going off task, and when they do go off task, they most often return after 1 to 4 minutes of disengagement. Our model has application in estimating the amount of engaged time students take to complete programming assignments, identifying students in need of intervention, and understanding the effects of different engagement behaviors.