Recent Releases of mousetrap
mousetrap - mousetrap 3.2.3
Internal changes
- Added link to online documentation in package description
- Moved heatmap examples to dontrun to temporarily address CRAN clang18 issue
- R
Published by PascalKieslich over 2 years ago
mousetrap - mousetrap 3.2.2
Announcements
- A tutorial to movement tracking of psychological processes with the
mousetrapR package has been published as a preprint. Please cite it as follows when usingmousetrapin your research: Wulff, D. U.*, Kieslich, P. J.*, Henninger, F., Haslbeck, J. M. B., & Schulte-Mecklenbeck, M. (2023). Movement tracking of psychological processes: A tutorial using mousetrap. PsyArXiv. https://doi.org/10.31234/osf.io/v685r
Bugs fixed
mt_import_long: Preserve original trial order when importing trajectories. This also fixes the issue that trajectories are imported incorrectly whenmt_id_labelcontains mixed case (closes #17, thanks to @LiKao)
Internal changes
- Implemented a suggestion by CRAN team regarding the setup of the package overview help file (accommodating changes in roxygen2)
- R
Published by PascalKieslich over 2 years ago
mousetrap - mousetrap 3.2.1
Announcements
- A tutorial to movement tracking of cognitive processes with the
mousetrapR package has been published as a preprint. Please cite it as follows when usingmousetrapin your research: Wulff, D. U., Kieslich, P. J., Henninger, F., Haslbeck, J. M. B., & Schulte-Mecklenbeck, M. (2021). Movement tracking of cognitive processes: A tutorial using mousetrap. PsyArXiv. https://doi.org/10.31234/osf.io/v685r - After more than 5 years,
mousetrapfinally has a logo (thanks to Dirk Wulff)
General changes to existing functions
- Introduction of lifecycle badges for experimental and deprecated functions using the
lifecyclepackage mt_space_normalizefunction that was already deprecated and replaced withmt_align_start_endhas been removed
New functions
mt_exclude_finish: Remove a potential phase without mouse movement at the end of the trial
Changes in specific functions
mt_average: Removeddimensionargument which was already deprecated and replaced withav_dimension
Bugs fixed
mt_time_normalizeandmt_resample: Setting thedimensionsargument to"all"now works (up to now, the functions simply returned an error when settingdimensions = "all")mt_angles: Now also works for the edge case that the trajectory array only contains a single trajectory (closes #15)mt_heatmap: Now passes on theverboseargument to the internally usedmt_heatmap_rawfunction to prevent messages frommt_heatmap_rawifverbose = FALSE
Internal changes
- Added internal
extract_dimensionsfunction for extracting dimensions from trajectory array that also handles edge case of trajectory array with single trajectory
- R
Published by PascalKieslich over 4 years ago
mousetrap - mousetrap 3.2.0
General changes to existing functions
- The
mt_spatializefunction has been replaced withmt_length_normalize(to achieve consistent naming analogous tomt_time_normalize). The new function offers the same functionality with the exception that the created trajectories are now by default calledln_trajectories(instead ofsp_trajectories), which stands for length-normalized trajectories and should ensure consistency in naming with time-normalized trajectories. - Because of the renaming of
sp_trajectoriestoln_trajectories, all functions that by default were using thesp_trajectoriesare now by default usingln_trajectories(e.g.,mt_clusterandmt_map). Additionally, to ease the transition many mousetrap functions now internally flexibly exchangeln_trajectoriesandsp_trajectoriesin theuseargument (if the specified trajectories are missing and the other trajectories are found) and throw a warning if they replace one with the other.
Changes in specific functions
mt_spatialize: function is deprecated and replaced withmt_length_normalize. The reason for this is to achieve consistent naming analogous tomt_time_normalize. Themt_length_normalizefunction offers the same functionality asmt_spatializewith the exception that the created trajectories are now by default calledln_trajectories(instead ofsp_trajectories), which stands for length-normalized trajectories and should ensure consistency in naming with time-normalized trajectories.mt_import_mousetrap: Now can also import trajectory coordinates when they are stored in scientific notation in the raw data (e.g.,2.98e-8).mt_plotandmt_plot_aggregate: Replacedonly_ggplotwithreturn_typeargument. The newreturn_typeargument allows for further customization of the plots:If return_type == "plot"(the default), a new ggplot is created and the trajectories are plotted usinggeom_path(corresponds to the old default behavior, whereonly_ggplotwas set toFALSE). Ifreturn_type == "mapping", only the ggplot object containing the mapping but without any geoms is returned (corresponds to the old behavior whereonly_ggplotwas set toTRUE). Ifreturn_type == "geoms", only the geoms are returned, which allows adding the plotted trajectories to an existing ggplot (new functionality).
Bugs fixed
mt_exclude_initiation: Bug fixed so that the correct initial position is used when removing the initial period without movement in a trial. Previously,mt_exclude_initiationwas only behaving as intended when the initial position was (0,0), which probably was the case in many settings (in particular, if the trajectories were aligned usingmt_align_startwith default start values). If the initial position in a trial corresponded to a different value, the initial period without movement in most cases was simply not removed. This has now been fixed (closes #14).
- R
Published by PascalKieslich almost 5 years ago
mousetrap - mousetrap 3.1.5
Changes in specific functions
mt_measures: Introducedinitiation_thresholdargument to allow specifying a minimum distance from the start point of the trajectory that needs to be exceeded for calculating the initiation time.mt_import_mousetrapandmt_check_resolution: Introduceddigitsargument. If specified, timestamps will be rounded which can potentially be useful if timestamps are recorded with submillisecond precision.mt_import_mousetrap: Introducedunorderedargument that allows for different options to handle unordered, that is, non-monotonically increasing timestamps within a trial.mt_plotandmt_plot_aggregate: Introducedwrap_varandwrap_ncolarguments that add wrapping to trajectory plots (i.e., splitting a plot across multiple columns and rows based on the levels of a single variable or a combination of variables).mt_plot_riverbed: Introducedna.rmargument which, if set toTRUE, allows the creation of riverbed plots from trajectories with unequal length (whether this is in practice desirable or not is an open question).
Internal changes
mt_import_long: Replaced dplyr/tidyr standard evaluation functions by using embracing and pivoting.mt_reshape: Replaced dplyr/tidyr standard evaluation functions by using embracing and pivoting.mt_plot_riverbedandmt_heatmap_ggplot: Replaced geomraster with geomtile.- Minor updates in documentation regarding function links and author information.
- R
Published by PascalKieslich almost 6 years ago
mousetrap - mousetrap 3.1.4
Announcements
- A book chapter on the mousetrap software packages has been published. It covers many common analyses using the mousetrap R package. Please cite it as follows when using mousetrap in your research:
- Kieslich, P. J., Henninger, F., Wulff, D. U., Haslbeck, J. M. B., & Schulte-Mecklenbeck, M. (2019). Mouse-tracking: A practical guide to implementation and analysis. In M. Schulte-Mecklenbeck, A. Kühberger, & J. G. Johnson (Eds.), A Handbook of Process Tracing Methods (pp. 111-130). New York, NY: Routledge.
- Besides, if you use functions for clustering and mapping trajectories, please also include the following reference:
- Wulff, D. U., Haslbeck, J. M. B., Kieslich, P. J., Henninger, F., & Schulte-Mecklenbeck, M. (2019). Mouse-tracking: Detecting types in movement trajectories. In M. Schulte-Mecklenbeck, A. Kühberger, & J. G. Johnson (Eds.), A Handbook of Process Tracing Methods (pp. 131-145). New York, NY: Routledge.
Changes in specific functions
mt_measures: Introducedhover_incl_intialargument to make inclusion of a potential initial phase without movement optional when calculating hovers. By default, this initial phase is included (as in previous versions).mt_measures: Multiple values can now be specified in thehover_thresholdargument. If this is done, hovers and hover_time will be returned in separate variables for each threshold value (the variable name will be suffixed with the threshold value).mt_measures: Multiple values can now be specified in theflip_thresholdargument. If this is done, flips (e.g., xpos_flips) will be returned in separate variables for each threshold value (the variable name will be suffixed with the threshold value).
Internal changes
- When checking the class of an object,
inheritsis now used consistently instead of theclassfunction to avoid problems with future R releases (>=4.0.0).
- R
Published by PascalKieslich over 6 years ago
mousetrap - mousetrap 3.1.3
Changes in specific functions
mt_sample_entropy: By default, sample entropy is calculated based on the differences of the position values (following Hehman et al., 2015). An optional argumentuse_diffnow has been introduced to allow users to override this behavior and use the untransformed values instead, by settinguse_diff=FALSE.mt_align_start_end: Now checks, if start and end points are equal for a trial (separately per dimension). If so, returns a warning message as the aligned trajectory values for the respective dimension will beNaN/Inf/-Inf.
- R
Published by PascalKieslich over 6 years ago
mousetrap - mousetrap 3.1.2
Changes in documentation
citation("mousetrap")now returns the correct citation for themousetrappackage.- Updated mousetrap book chapter citations (see announcements above for correct citation).
Changes in specific functions
mt_import_long: internal change (prefixrow_number()function with dplyr) to accomodate changes in dplyr 0.8.0.
- R
Published by PascalKieslich over 7 years ago
mousetrap - mousetrap 3.1.1
Announcements
- Book chapters on the mousetrap software packages have been accepted for publication. See version 3.1.3 above for updated references (as the book chapters meanwhile have been published).
- If you have any questions when using mousetrap, you can now ask them in the mousetrap forum at http://forum.cogsci.nl/index.php?p=/categories/mousetrap
Changes in specific functions
mt_map: now allows for mapping trajectories onto prototypes separately for different groups of trajectories (the prototypes will be rescaled separately to match the coordinate system of each group).mt_heatmap_ggplot: now allows for faceting using thefacet_rowandfacet_colarguments.mt_diffmap: theconditioncan now simply be specified by providing the corresponding variable name (and the condition values can now be any type, provided that they only contain two levels).mt_plotandmt_plot_aggregate: transparency and line width can now be varied via thealphaandsizearguments.mt_plot_riverbed: introducedgrid_colorsargument for setting the grid colors (usegrid_colors = NAto omit grid lines).mt_reshape: internal changes reflecting changes indplyr::summarize_at.mt_align_startandmt_align_start_end: ifstartis computed internally, it is now ensured that it is a named vector.mt_plot_add_rect: it is now ensured that this function does not influence the legend (previously, this could happen if thelinetypeargument was used inmt_plot)
- R
Published by PascalKieslich almost 8 years ago
mousetrap - mousetrap 3.1.0
Announcements
- A first paper on the mousetrap software packages has been accepted for publication. It presents the mousetrap plugin for creating mouse-tracking experiments in OpenSesame and also includes a short demonstration of basic analyses using the mousetrap R package.
- Reference: Kieslich, P. J., & Henninger, F. (in press). Mousetrap: An integrated, open-source mouse-tracking package. Behavior Research Methods. doi:10.3758/s13428-017-0900-z
Changes in specific functions
mt_derivatives: now always reports acceleration as difference in absolute velocity (the argumentacc_on_abs_velhas been removed). Besides, the argumentabsolutehas been introduced that indicates if absolute values for distances and velocities should be reported (by default, this is not the case). All of this is only relevant if a single dimension is specified indimensions.mt_sample_entropy: the default values reported have changed (cf. bug fix below).mt_sample_entropynow only uses a custom function for computing sample entropy (which is faster and produces virtually identical results aspracma::sample_entropyif the same parameters are used). Therefore, themethodargument has been removed. Besides, thelagargument has been renamed tom.mt_distmat,mt_cluster,mt_cluster_k, andmt_map: now provide the option to remove trajectory points containing missing values (by setting thena_rmargument toTRUE). Removal is done column-wise. That is, if any trajectory has a missing value at, e.g., the 10th recorded position, the 10th position is removed for all trajectories.mt_distmat,mt_cluster,mt_cluster_k, andmt_map: now allow for specifying the relative importance of each trajectory dimension via theweightsargument. Technically, each variable is rescaled so that the standard deviation matches the corresponding value inweights. By default,weightsis a vector of 1s implying equal importance of each dimension (i.e., all dimensions are standardized to a standard deviation of 1). This changes the default behavior of the functions compared to the previous release where the original variables were used without standardization. To use the original variables, setweights = NULL.mt_map: usesmousetrap::mt_prototypesas default forprototypesif no prototypes are provided.mt_average: now internally replaces NaNs with NAs. NaNs only occur if a specific dimension contains only NAs for an interval (which in practice only happens for acc values if the trial stops at the interval boundary).mt_standardize: now by default standardizes mouse-tracking measures across all trials if nowithinvariable is specified.
Bugs fixed
mt_sample_entropy: Bug fixed formethod="pracma"(the default method): The window size argument (which used to be specified using thelagargument - now this has been renamed tom) was incorrectly passed on to thetauargument ofpracma::sample_entropy. It should have beend passed on to theedimargument. After fixing this, both methods inmt_sample_entropyprovided virtually identical results (which is why themethodargument has been dropped, see above).
New functions
bezier: create Bezier-curves using the Bernstein approximation.mt_scale_trajectories: standardize variables in a mouse trajectory array.mt_heatmap_raw: create high-resolution heatmap of trajectory data.mt_heatmap: plot trajectory heatmap using base plots.mt_heatmap_ggplot: plot trajectory heatmap using ggplot.mt_diffmap: create a difference-heatmap of two trajectory heatmap images.mt_animate: create a gif trajectory animation.- Please note that although these functions have been tested extensively, they still have beta status.
New data
KH2017_raw: Raw mouse-tracking dataset from Kieslich & Henninger (in press).KH2017: Mouse-tracking dataset from Kieslich & Henninger (in press).
- R
Published by PascalKieslich about 9 years ago
mousetrap - mousetrap 3.0.0
Announcements
- We are delighted that Dirk Wulff and Jonas Haslbeck have joined the
mousetrapteam! They are contributing a number of new functions, particularly for clustering and visualization. - The documentation of the
mousetrappackage can now also be found online at http://pascalkieslich.github.io/mousetrap/
General changes to existing functions
- Introduction of class
mousetrapfor mousetrap data objects (such asmt_example). This facilitates, among other things, checking of the data class. - Change of dimension order for all trajectory arrays: The old order was 1) trials, 2) variables, 3) samples. The new order is 1) trials, 2) samples, 3) variables. All functions and example data have been modified accordingly.
- Many reshape, aggregation, export, and plotting functions now accept a trajectory array as direct input to
data. - In case an analysis function adds measures to an existing data.frame, existing columns of the same name are now replaced and a warning is displayed (instead of merging the data.frames and adding generic suffixes).
- Arguments that were already deprecated and replaced (e.g.,
show_progresswas replaced withverbose) have been removed.
Changes in specific functions
mt_align_start: function is now vectorized and allows for optionally aligning to mean start position across trials; default forsave_asargument is set touse.mt_space_normalize: function is deprecated and replaced withmt_align_start_end. It offers similar functionality but is vectorized and allows for optionally aligning to mean start/end position across trials.mt_resample: now provides option to perform partial constant interpolation. Thanks to @sbrockhaus for the suggestion (cf. #7, #9).mt_derivatives: now provides option to additionally return timestamp differences.mt_measures: now optionally determines the number and duration of hovers (cf. #9), improved documentation and report of time measures (cf. #6).mt_plot: introducedfacet_rowandfacet_colarguments for faceting.mt_plot_add_rect: internal change to avoid warning message (due to changes inggplot2).mt_plot_riverbed: explicitly remove zero frequencies instead of relying on the alpha parameter.
New functions
read_mt: read MouseTracker raw data (.mt files).mt_align: general purpose function for aligning and rescaling trajectories. For specific operations, you can rely on the specialized functionsmt_align_startandmt_align_start_end.mt_spatialize: re-represent each trajectory spatially so that adjacent points become equidistant to each other.mt_add_trajectory: add a new trajectory to a trajectory array.mt_bind: join two trajectory arrays.mt_count: count the number of observations for each trajectory.mt_angles: calculate movement angles for trajectories.mt_distmat: compute the distance matrix for each pair of trajectories.mt_cluster: perform trajectory clustering with a specified number of clusters.mt_cluster_k: estimate the optimal number of clusters using various methods.mt_map: map trajectories onto a predefined set of prototype trajectories (a core set is provided inmt_prototypes).
Bugs fixed
mt_measures: make checks for timestamps > 0 and < 0 independent. Thanks to Regina Köhler for pointing this out.mt_plot_per_trajectory: fix bug that all trajectories were plotted on each page (introduced through previous change inmt_reshape). Thanks to Bence Palfi for discovering this.create_results(internal function): Explicitly select mtid column (instead of assuming that it is the first column - which is, e.g., often not the case indata[["data"]]); ensure for caseoverwrite=FALSEthat function also works when multiple columns are merged and when all columns except mtid are dropped beforehand.
Removed functions
read_mousetracker: removed as it is recommended to directly import the MouseTracker raw data using the new functionread_mt.mt_movement_angle: removed as it is replaced with new and more general functionmt_angles.mt_calculate_derivatives,mt_calculate_deviations,mt_calculate_measures: removed as they were previously deprecated and replaced withmt_derivatives,mt_deviations,mt_measures.
- R
Published by PascalKieslich over 9 years ago
mousetrap - mousetrap 2.0.0
General changes to all existing functions
- Renamed
show_progressargument toverbose(+ set default toFALSE). - Introduced
dimensionsargument to explicitly specify the names of the columns in the trajectory array that contain the mouse positions. In most cases, the default isc("xpos","ypos")as the x- and y-positions should be used. Note that in some functions (as specified in the documentation) the order of the labels matters, the first value will be taken as the label of the x-positions, the second as the label of the y-positions. - Introduced
timestampsargument to explicitly specify the dimension in the trajectory array containing the timestamps. - Perform merging of trial and trajectory data (e.g., in
mt_subsetandmt_reshape) based on therownames. Therefore, themt_idcolumn in data.frames is not needed anymore - but is kept for the convenience of the user. The column is called"mt_id"in import and measures functions.mt_reshapeallows the user to specify the label of themt_idcolumn explicitly. - As a consequence of the previous changes: Removal of the internal variables
mt_variable_labelsandmt_id. - Removed "calculate" from all mtcalculate functions: `mtcalculatemeasures
,mtcalculatederivatives,mtcalculatedeviationsare now calledmtmeasures,mtderivatives,mtdeviations`. - Introduction of internal utils function
create_results(that simplifies including the newly created trajectories or measures in the existing mousetrap data object). - Performance improvement of reshaping, aggregation, and visualization functions through internal changes in
mt_reshape:base::mergeandreshape2functions are replaced with functions from thetidyranddplyrpackages (and custom functions). Package dependencies were adjusted accordingly. As thedplyrfunctions may introduce additional classes for the reshaped data (such asgrouped_dfandtbl_df), a new argument (convert_df) is introduced that converts the reshaped data to "pure" data.frames by default (thereby dropping additional classes).
Changes in specific functions
mt_import_mousetrap,mt_import_long,mt_import_wide: Allow specifying several variables for the trial identifier inmt_id_label. A new ID variable will be created by combining the values of each variable.mt_import_mousetrap: Make import more robust against variables with empty logs (warning message is returned in the end) (closes #5, thanks to @sbrockhaus).mt_import_long,mt_import_wide: Import any number of additional variables usingadd_labels(closes #4).mt_import_long: Timestamps are no longer used for ordering ifmt_seq_labelis not provided. Instead, data will be imported in the order in which they were stored inraw_data.mt_import_long: Improved speed by relying on functions from thetidyranddplyrpackages.mt_space_normalize,mt_align_start: Introduction ofdimensionsargument and the corresponding argumentsstartandend(deprecatexpos_start/xpos_end/ypos_start/ypos_end). This also fixes the internal bug that inmt_align_startxpos_startwas passed on asypos_starttomt_space_normalize(instead ofypos_start).mt_derivatives: Renamedimensionargument todimensions, enable function to work with an arbitrary number of dimensions.mt_deviations: Vectorized functionpoint_to_linefor time speed up (closes #2, thanks to @sbrockhaus).mt_measures: Allow for flexible dimension labels and rename all measures columns relating only to x- or y-positions depending on the values in dimensions (e.g.,x_maxbecomesxpos_max,x_flipsbecomesxpos_flips). Change column labelxy_disttototal_dist.mt_measures: Simplify AUC calculation using the actual x- and y-positions . New AUC values correlate to 1.00 with old values inmt_example, but in some cases extremely small differences are possible (maximum difference of 2.328e-10 in mt_example).mt_reshape,mt_aggregate,mt_aggregate_per_subject: Replaceaggregation_functionargument with.funs, which is passed on to the aggregation function(summarize_at)..funsalso allows for specifying several aggregation functions.mt_plot_per_trajectory: New argumentsxlimandylimfor specifying the axes limits explicitly andaxes_exactfor plotting exact axes.mt_plot_per_trajectory: New argumentsrect,color, andfillfor plotting rectangles (usually representing the response buttons).mt_plot(and related functions): New argumentpointsallows for plotting points.
New functions
mt_add_variables: add new variables to trajectory array.mt_export_long: export mouse-tracking data in long format (wrapper formt_reshape).mt_export_wide: export mouse-tracking data in wide format (wrapper formt_reshape).
Bugs fixed
mt_align_start: Fixed bug thatxpos_start(instead ofypos_start) was passed on asypos_starttomt_space_normalize.mt_average: Fixed bug that if intervals were specified explicitly usingintervals, the wrong interval size was used when averaging (the default size of 100 was used).
- R
Published by PascalKieslich over 9 years ago
mousetrap - mousetrap 1.2.0
Changes
- New function
mt_align_startadjusts trajectories so that they have the same start position (wrapper formt_space_normalize) - New function
mt_calculate_deviationscalculates the idealized trajectory and the perpendicular deviations of the actual trajectory from it for each position in the trajectory array - For many functions, a trajectory array can now be provided directly via the
dataargument. In this case, theuseargument will be ignored and only the resulting trajectory array will be returned mt_plot_riverbednow preserves factor levels for facetsmt_calculate_derivativesnow allows for custom dimension names using theprefixargumentmt_plot_per_trajectorynow receives the file name as the first argument
- R
Published by PascalKieslich almost 10 years ago
mousetrap - mousetrap 1.1.0
Changes
mt_import_mousetrapnow offers possibility to combine several variables in mouse-tracking raw datamt_plot_riverbednow allows for facetingmt_check_resolutionnow offers possibility to check (relative) frequencies of desired timestamp differences- Improved preprocessing of mouse-tracking raw data for
mt_import_mousetrap - Change of default scale for fill in
mt_plot_riverbed - Custom x and y axis labels for
mt_plot_riverbedcan no longer be set viax_labelandy_label(but can be added using theggplot2functionsxlab()andylab(), see Examples) - Minor fix in package documentation (#1) (thanks to @sbrockhaus)
- Minor fix in documentation of x/y reversals (thanks to Barnabás Szászi)
- R
Published by PascalKieslich almost 10 years ago
mousetrap - mousetrap 1.0.0
This is the first release of the mousetrap package. We hope that the package enables users to easily import, preprocess, analyze, aggregate and visualize mouse-tracking data in R. We are looking forward to your feedback!
- R
Published by PascalKieslich about 10 years ago