Inititation time calculation in mousetrap vs mousetracker
The intitiation times in the mousetracker files and those calculated by mt_measures
are different: mousetracker has longer initiation times. Does anyone know how mousetracker calculates the initiation time? I looked at the initial mousetracker article (http://www.jbfreeman.net/pubs/Freeman_BRM.pdf) but could not find any relevant information.
----------------------------------------------
Here is what I did. I imported mousetracker data and the calculated initiation times with the following code:
library(mousetrap) raw_data_wide <- read_mt('1_180422_1712.mt') mt_data <- mt_import_wide(raw_data_wide) measures <- mt_measures(mt_data$trajectories)
Comparing initiation times showed that mousetrap always reports smaller values:
table(measures[, 'initiation_time'] - mt_data$data[, 'init.time']) -40 -30 -20 131 177 18
I looked into a couple of trajectories:
mousetrap: 530 mousetracker: 560 timestamps xpos ypos [1,] 490 960 1044 [2,] 500 960 1044 [3,] 520 960 1044 [4,] 530 960 1044 - mousetrap initiation time [5,] 550 947 1038 - before mousetracker initiation time [6,] 570 941 1037 - after mousetracker initiation time [7,] 580 937 1033 [8,] 600 925 1026 [9,] 610 914 1020
From the trial above, it might seem like mousetracker uses the average of the first two points that have deviated from the starting point while mousetrap uses the last on where there is still no movement. There is this one, however:
mousetrap: 2780 mousetracker: 2810 timestamps xpos ypos [1,] 2730 960 1044 [2,] 2750 960 1044 [3,] 2760 960 1044 [4,] 2780 960 1044 - mousetrap initiation time [5,] 2790 966 1039 [6,] 2810 1008 963 - mousetracker initiation time [7,] 2820 1033 929 [8,] 2840 1135 798 [9,] 2860 1215 702
In the trial above, the mousetracker's initiation time coincides with one of the timestamps exactly.
And there is this one:
mousetrap: 0 mousetracker: 30 timestamps xpos ypos [1,] 0 960 1044 - mousetrap initiation time [2,] 10 960 1040 [3,] 30 960 1040 - mousetracker initiation time [4,] 40 960 1040 [5,] 60 960 1040 [6,] 70 960 1040
Here, mousetracker skips one point which has exactly the same coordinates as the next one whose timestamp becomes the initiation time.
Comments
That's an interesting question. I can only provide the information how mousetrap computes the initation time in mt_measures. It is exactly done as you describe, i.e., the initiation time is defined as the last timestamp before movement initialization, and it is good to see that this works consistently in all your examples.
With regard to MouseTracker initiaton times I don't have an explanation that could explain all your examples above. One speculation I have could be that maybe MouseTracker internally uses a threshold for the minimum distance traveled? Or it is as you speculate that there is some timestamp averaging happening. However, particularly the last example strikes me as a bit odd. I think the best thing would be to reach out to Jon Freeman if you would like to get a definitive answer. I am sure he is happy to help.
Thank you for the explanation @Pascal. I will reach out to Jon Freeman about the mousetracker side of things and post back here.
Strange differences in initiation times were due to timestamp resetting. Setting it to False gives consistent results. The initiation times are still different but only because moustrap uses the timestamp of the last point before movement whereas Mousetracker uses the timestamp of the point after that.