mt_sample_entropy(data, use = "tn_trajectories", save_as = "measures", dimension = "xpos", method = "pracma", lag = 3, r = NULL, verbose = FALSE, show_progress = NULL)use will be ignored).verbose instead.save_as (by default
"measures") already exists, the sample entropy values are added as
additional column(s).If not, an additional data.frame will be added.If a trajectory array was provided directly as data, only the
data.frame will be returned.
mt_sample_entropy calculates the sample entropy for each trajectory as
a measure of its complexity. Hehman et al (2015) provide details on how
sample entropy can be calculated and applied in mouse-tracking (following
Dale et al., 2007). They apply the sample entropy measure to the x-positions
(which is also the default here, as in a standard mouse-tracking task with
buttons located in the top-left and right corners mostly the movements in the
horizontal direction are of interest). Besides, they recommend using the
time-normalized trajectories so all trajectories have the same length.Sample entropy is computed by comparing windows of a fixed size (specified
using lag) across all recorded positions. Sample entropy is the
negative natural logarithm of the conditional probability that this windows
remains similar across the trial (Hehman et al., 2015). A window is
considered to be similar to another if their distance is smaller than a
specified tolerance value (which can be specified using r). Hehman et
al. (2015) use a tolerance value of 0.2 * standard deviation of all
differences between adjacent x-positions in the dataset (which is the default
implemented here).
The specific formula for sample entropy depends on the function specified in
method. Per default ("pracma"), the sample_entropy
function from the pracma package is used. Alternatively ("hehman") the
function by Hehman et al. (2015) is used. Finally, it is also possible to
calculate sample_entropy values using both functions ("both").
Hehman, E., Stolier, R. M., & Freeman, J. B. (2015). Advanced mouse-tracking analytic techniques for enhancing psychological science. Group Processes & Intergroup Relations, 18(3), 384-401.
# Calculate sample entropy based on time-normalized
# trajectories and merge results with other meausres
# derived from raw trajectories
mt_example <- mt_measures(mt_example)
mt_example <- mt_time_normalize(mt_example,
save_as="tn_trajectories", nsteps=101)
mt_example <- mt_sample_entropy(mt_example,
use="tn_trajectories", save_as="measures",
method="pracma", dimension="xpos", lag=3)
Run the code above in your browser using DataLab