mt_derivatives(data, use = "trajectories", save_as = use, dimensions = c("xpos", "ypos"), timestamps = "timestamps", prefix = "", acc_on_abs_vel = FALSE, verbose = FALSE, show_progress = NULL, dimension = NULL)
mt_calculate_derivatives(data, use = "trajectories", save_as = use, dimensions = c("xpos", "ypos"), timestamps = "timestamps", prefix = "", acc_on_abs_vel = FALSE, verbose = FALSE, show_progress = NULL, dimension = NULL)use will be ignored).c("xpos","ypos")), they are calculated across both x and y
dimensions. Alternatively, only one dimesion can be specified, e.g.,
"xpos" or "ypos".verbose instead.dimensions instead.dist, vel, and acc, if no
prefix was specified). If the trajectory array was provided directly as
data, only the trajectory array will be returned.
mt_derivatives: Calculate distance, velocity, and acceleration mt_calculate_derivatives: Deprecated
The first entry in each respective vector is always zero. Each subsequent entry thus represents the Euclidean distance traveled since the previous recorded set of coordinates and the velocity with which the movement between both samples took place. Thus, both distance and velocity represent the intervening period between the previous sample and the one with which the numeric value is saved.
The acceleration, by contrast, denotes the change in velocity between two adjacent periods. Because of this, it is shifted forward to best match the actual time point at which the acceleration was measured. Because there will always be one less value computed for acceleration than for velocity, the final value in the acceleration vector has been padded with an NA. To reconstruct the velocity from the acceleration, multiply the acceleration vector with the sampling interval, compute the cumulative sum of the result, and add a zero at the beginning.
If the distance is calculated across both horizontal and vertical (x and y) dimensions, distance and velocity is always positive (or 0). If only one dimension is used, increases in x (or y) values result in positive distances and velocity values, decreases in negative distances and velocity values.
mt_measures for calculating per-trial mouse-tracking measures.
# Calculate derivatives looking at movement
# across both dimensions
mt_example <- mt_derivatives(mt_example)
# Calculate derivatives ony looking at movement
# in x dimension
mt_example <- mt_derivatives(mt_example,
dimensions="xpos")
Run the code above in your browser using DataLab