Trajectory Metrics

This section covers various trajectory metrics used to analyze the users trajectory, such as path length or AUC, which provide insights into movement efficiency and accuracy during user interactions in a mathematically rigorous manner.

Path and Total Distance

The path or total distance traveled during session interactions is a key metric for analyzing movement efficiency [Katerina and Nicolaos, 2018, Seelye et al., 2015, Rhim et al., 2023, Kieslich et al., 2019].

The function path() calculates the path length for interaction points from a DataFrame or session traces. This function computes the path length based on the Euclidean distance between consecutive points.

The distance between consecutive points is calculated as:

\[d_i = \sqrt{(x_{i} - x_{i-1})^2 + (y_{i} - y_{i-1})^2}\]

The total distance is the aggregation of all paths for the session, representing the total traversed trajectory of the user. The function total_distance() calculates the total distance for either each session without traces, with traces or for the entire DataFrame.

Note

Computing the path per traces and without traces does not render the same “global” result.

To get more information about this, refer to the Context Specific Metrics section in the documentation.

AUC

The Area Under the Curve (AUC) quantifies the overall movement efficiency during user interactions in computers [Katerina and Nicolaos, 2018, Kieslich et al., 2019] or even in mobile devices [Rhim et al., 2023].

The function auc() computes the AUC for a DataFrame or session traces. The current implementation returns a tuple of geometric AUC and execution AUC when operating on a single DataFrame, and a dictionary keyed by session containing lists of those two values when operating trace-wise.

In other words, for each trajectory segment it evaluates the area under the curve considering both the geometric path and the execution-time profile of the movement. This allows one to compare the actual trajectory geometry against the temporal execution of the interaction.

Metrics such as mean, maximum, and minimum AUC values can still be summarized afterward from the per-session outputs when needed.

Maximum Absolute Deviation

The Maximum Absolute Deviation (MAD) is a metric that quantifies the maximum deviation of the actual movement path from the optimal straight-line path during user interactions [Katerina and Nicolaos, 2018, Rhim et al., 2023, Kieslich et al., 2019].

The function deviations() calculates the MAD for each session or interaction trace, returning both the mean, maximum and minimum MAD values.

The MAD is calculated as the maximum perpendicular distance from any point on the actual path to the straight line connecting the start and end points of the movement.

Diagram illustrating Maximum Absolute Deviation (MAD)

Diagram illustrating Maximum Absolute Deviation (MAD)

Average Absolute Deviation

The Average Absolute Deviation (AAD) is a metric that quantifies the average deviation of the actual movement path from the optimal straight-line path during user interactions [Rhim et al., 2023].

It consists of the average value of the perpendicular distances from each point of the trajectory to the straight line connecting the start and end points of the movement (optimal trajectory).

The function deviations() calculates the AAD for each session or interaction trace, returning the AAD value along with MAD metrics.

Diagram illustrating Average Absolute Deviation (AAD)

Diagram illustrating Average Absolute Deviation (AAD)

Direction Changes

The number of direction changes is a metric that quantifies how often the movement direction reverses or shifts substantially during a trajectory.

The function direction_changes() computes the direction of each displacement vector from \(\Delta x\) and \(\Delta y\), then evaluates the angular difference between consecutive steps. A direction change is counted when the absolute angular difference exceeds 45 degrees, i.e., more than \(\pi / 4\) radians.

This metric is directly related to its submetrics x_flips() and y_flips(), which count directional reversals along the x-axis and y-axis, respectively.

X-direction Flips

The function x_flips() counts how many times the x-component of movement changes sign beyond a given threshold. In the implementation, the threshold is set by default to 0.1, and the metric is computed from the displacement along the x-axis, \(\Delta x\).

This captures horizontal reversals in movement, such as when the cursor starts moving left after having moved right, or vice versa.

Note

Context specificity: when computed on traces, the function sums the flips across all traces in each session. A flip occurring between the end of one trace and the beginning of the next one is not counted, because the computation is performed trace by trace. To include those transitions, compute the metric on the full dataframe or combine the traces into a single movement sequence.

Y-direction Flips

The function y_flips() follows the same logic as x_flips(), but applied to the y-component of movement, \(\Delta y\).

It counts the number of times the vertical direction changes sign beyond the configured threshold, which is useful for detecting upward and downward reversals in the trajectory.

Note

Context specificity: when computed on traces, the function sums the flips across all traces in each session. A flip occurring between the end of one trace and the beginning of the next one is not counted, because the computation is performed trace by trace. To include those transitions, compute the metric on the full dataframe or integrate the traces into a single trajectory.

References

[1] (1,2,3)

Tzafilkou Katerina and Protogeros Nicolaos. Mouse behavioral patterns and keystroke dynamics in End-User development: what can they tell us about users' behavioral attributes? Comput. Human Behav., 83:288–305, June 2018. URL: https://doi.org/10.1016/j.chb.2018.02.012.

[2]

Catia Cepeda, Joao Rodrigues, Maria Camila Dias, Diogo Oliveira, Dina Rindlisbacher, Marcus Cheetham, and Hugo Gamboa. Mouse tracking measures and movement patterns with application for online surveys. In Lecture Notes in Computer Science, Lecture notes in computer science, pages 28–42. Springer International Publishing, Cham, 2018. URL: https://dl.acm.org/doi/10.1007/978-3-319-99740-7_3.

[3]

Adriana Seelye, Stuart Hagler, Nora Mattek, Diane B Howieson, Katherine Wild, Hiroko H Dodge, and Jeffrey A Kaye. Computer mouse movement patterns: a potential marker of mild cognitive impairment. Alzheimers Dement. (Amst.), 1(4):472–480, December 2015. URL: https://alz-journals.onlinelibrary.wiley.com/doi/10.1016/j.dadm.2015.09.006.

[4]

Iftikhar Ahmed Khan, Willem-Paul Brinkman, Nick Fine, and Robert M Hierons. Measuring personality from keyboard and mouse use. In Proceedings of the 15th European conference on Cognitive ergonomics: the ergonomics of cool interaction. New York, NY, USA, January 2008. ACM.

[5] (1,2,3,4)

Jungwook Rhim, Jiwon Kim, and Gahgene Gweon. Using geometric features of drag-and-drop trajectories to understand students' learning. In Proceedings of the 2023 CHI Conference on Human Factors in Computing Systems, volume 19, 1–14. New York, NY, USA, April 2023. ACM. URL: https://dl.acm.org/doi/10.1145/3544548.3581143.

[6]

Masud Karim and Md Hasanuzzaman. A study on mouse movement features to identify user. Sci. Res. J., 08(04):77–82, April 2020.

[7]

Fabian Monrose and Aviel D Rubin. Keystroke dynamics as a biometric for authentication. Future Gener. Comput. Syst., 16(4):351–359, February 2000.

[8]

Dirk U Wulff, Pascal J Kieslich, Felix Henninger, Jonas M B Haslbeck, and Michael Schulte-Mecklenbeck. Movement tracking of psychological processes: a tutorial using mousetrap. Behav. Res. Methods, 57(11):307, October 2025.

[9]

Guillermo Dylan Carvajal-Aza, Alejandro Alvarez-Varela, Javier De Andres, Martin Gonzalez-Rodriguez, Daniel Fernandez-Lanvin, and Mercedes Paino. Pywib: a python library for a multi-modal approach to web interaction behavior analysis. In Proceedings of the 2026 IARIA Annual Congress on Frontiers in Science, Technology, Services, and Applications (IARIA Congress 2026), 103–108. Nice, France, 2026. IARIA Press. URL: https://www.thinkmind.org/library/IARIA_CONGRESS/IARIA_Congress_2026/iaria_congress_2026_1_170_50103.html.

[10]

Martin Schoemann, Malte Lüken, Tobias Grage, Pascal J Kieslich, and Stefan Scherbaum. Validating mouse-tracking: how design factors influence action dynamics in intertemporal decision making. Behav. Res. Methods, 51(5):2356–2377, October 2019.

[11]

Eduard Kuric, Peter Demcak, Matus Krajcovic, and Peter Nemcek. Is mouse dynamics information credible for user behavior research? an empirical investigation. Comput. Stand. Interfaces, 90(103849):103849, August 2024.

[12] (1,2,3)

Pascal J. Kieslich, Felix Henninger, Dirk U. Wulff, Jonas M. B. Haslbeck, and Michael Schulte-Mecklenbeck. Mouse-tracking: a practical guide to implementation and analysis. In A Handbook of Process Tracing Methods, pages 20. Routledge, 2nd edition edition, 2019. URL: https://www.taylorfrancis.com/chapters/edit/10.4324/9781315160559-9/mouse-tracking-pascal-kieslich-felix-henninger-dirk-wulff-jonas-haslbeck-michael-schulte-mecklenbeck.

[13]

Christian O'Reilly and Réjean Plamondon. Can computer mice be used as low-cost devices for the acquisition of planar human movement velocity signals? Behav. Res. Methods, 43(1):229–238, March 2011. URL: https://link.springer.com/article/10.3758/s13428-010-0030-3#notes.

[14]

Beatriz Pariente-Martinez, Martin Gonzalez-Rodriguez, Daniel Fernandez-Lanvin, and Javier De Andres-Suarez. Measuring the role of age in user performance during interaction with computers. Univers. Access Inf. Soc., 15(2):237–247, June 2016. URL: https://link.springer.com/article/10.1007/s10209-014-0388-6.

[15]

Clayton Epp, Michael Lippold, and Regan L Mandryk. Identifying emotional states using keystroke dynamics. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems. New York, NY, USA, May 2011. ACM.

[16]

Preeti Khanna and M Sasikumar. Recognising emotions from keyboard stroke pattern. Int. J. Comput. Appl., 11(9):1–5, December 2010.

[17]

Lisa M Vizer, Lina Zhou, and Andrew Sears. Automated stress detection using keystroke and linguistic features: an exploratory study. Int. J. Hum. Comput. Stud., 67(10):870–886, October 2009.

[18]

A F M Nazmul Haque Nahin, Jawad Mohammad Alam, Hasan Mahmud, and Kamrul Hasan. Identifying emotion by keystroke dynamics and text pattern analysis. Behav. Inf. Technol., 33(9):987–996, September 2014.

[19]

Maarten Dijkstra. The diagnosis of self-efficacy using mouse and keyboard input. PhD thesis, Utrecht University, 2013.