Movement Metrics ================ .. currentmodule:: pywib This sections describes metrics related to the movement of the mouse or touch interactions. All of this metrics can be computed by using traces. To understand traces, please refer to the `Segmentation <\segmentation.html>`_ section in the documentation. Velocity -------- The velocity is the rate of change of position with respect to time. Commonly used to analyze the speed of movement during user interactions :cite:p:`Kieslich2019-mt, Katerina2018-ch`. Computer mouses have been proven to be reliable enough to measure human velocity :cite:p:`OReilly2011-dw` and have even been considered as valid tools to obtain markers for cognitive immpairment :cite:p:`Seelye2015-yx`. Velocity and time have also been proven to be affected by aging :cite:p:`Pariente-Martinez2016-te` up to a certain point and for some activies carried out in computers and web enviornments. The function :py:func:`~pywib.velocity` computes the velocity based on the distance and time difference between consecutive points. The velocity is calculated as: .. |xi| replace:: :math:`x_i` .. |yi| replace:: :math:`y_i` .. |ti| replace:: :math:`t_i` .. |i| replace:: :math:`i` .. math:: v_i = \frac{\sqrt{(x_{i} - x_{i-1})^2 + (y_{i} - y_{i-1})^2}}{t_{i} - t_{i-1}} where (|xi|, |yi|) are the coordinates and (|ti|) is the timestamp of point (|i|). The function :py:func:`~pywib.velocity_metrics` computes the mean, max, and min of the velocity values for each session. Acceleration ------------ The acceleration is the rate of change of velocity with respect to time, which provides insights into how quickly users change their speed during interactions :cite:p:`Kieslich2019-mt,Katerina2018-ch`. The function :py:func:`~pywib.acceleration` computes the acceleration based on the change in velocity over time from a DataFrame or session traces. The acceleration is calculated as: .. |vi| replace:: :math:`v_i` .. math:: a_i = \frac{v_{i} - v_{i+1}}{t_{i} - t_{i+1}} where \(|vi|\) is the velocity at point \(|i|\) and \(|ti|\) is the timestamp of point \(|i|\). Maximum, minimum, and mean acceleration metrics for each session can be computed using the function :py:func:`~pywib.acceleration_metrics`. Jerkiness --------- The function :py:func:`~pywib.jerkiness` computes the jerkiness of interaction points from a DataFrame or session traces, based on the change in acceleration over time. The jerkiness is calculated as the change in acceleration per unit time: .. |ai| replace:: :math:`a_i` .. math:: j_i = \frac{a_{i} - a_{i+1}}{t_{i} - t_{i+1}} where \(|ai|\) is the acceleration at point \(|i|\) and \(|ti|\) is the timestamp of point \(|i|\). The function :py:func:`~pywib.jerkiness_metrics` computes jerkiness metrics such as mean, max, and min jerkiness for each session. Angle ----- The angle metric measures the turning angle formed by three consecutive points in a trajectory. The function :py:func:`~pywib.angle` computes this angle from the vectors defined by neighboring points around the middle point. If the trajectory contains points :math:`p_{i-1}, p_i, p_{i+1}` with vectors .. math:: u = p_i - p_{i-1}, \qquad v = p_{i+1} - p_i then the turning angle is the angle between :math:`u` and :math:`v`. This provides a local measure of curvature and directional change between consecutive segments. When called on a DataFrame, the function can return the angle series directly or, when traces are provided, it can compute the angle for each trace separately and return the results grouped by session. Angular Velocity ---------------- The function :py:func:`~pywib.angular_velocity` computes the change in angular position over time. In other words, it estimates the rate at which the trajectory turns as the user moves. If the angle values are denoted by :math:`\theta_i` and the timestamps by :math:`t_i`, the angular velocity is computed as: .. math:: \omega_i = \frac{\theta_i - \theta_{i-1}}{t_i - t_{i-1}} The implementation automatically derives the required angle and time-difference columns when they are missing, and it can operate either on the whole DataFrame or on each trace in a session. Angular Acceleration -------------------- The function :py:func:`~pywib.angular_acceleration` computes the change in angular velocity over time. This metric captures how quickly the turning rate itself changes during the movement. If the angular velocity is denoted by :math:`\omega_i`, then angular acceleration is: .. math:: \alpha_i = \frac{\omega_i - \omega_{i-1}}{t_i - t_{i-1}} As with angular velocity, the implementation can work directly on a DataFrame or over session traces, and it will compute any intermediate columns needed before estimating the acceleration. References ---------- .. bibliography:: :style: apa