#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# Deviation from straight line up

If I want to compute the MAD and AUC from a straight line up, how would I do that?

My data looks like below

I tried

mt <- mt_align(mt, coordinates = c(0, 0, -1, 1.2124))

mt <- mt_time_normalize(mt)

I then use some custom code to flip some of the trajectories to the left based on a given condition

mt<- mt_deviations(mt,end_ideal = c(0, 1.2124))

followed by mt_measures, but my AUC and MAD occasionally come back positive - even though my data clearly shows a trend to the left (with the exception of one trajectory)

xpos_min shows up as expected

It seems to be doing something with whether the first xpos_max is positive or negative to some extent, but I cant use mt_align with align_start because it makes the trajectories weird

• Hi there,

details on the calculation of MAD and AUC in mousetrap are described here: http://pascalkieslich.github.io/mousetrap/reference/mt_measures.html#details-1 (and in general how deviations from the idealized straight line are calculated is described here http://pascalkieslich.github.io/mousetrap/reference/mt_deviations.html).

I think that the challenge in your data is that the x position of the start of your trajectory and the end are very closely to each other, which is unusual for mouse-tracking experiments where the cursor usually starts somewhere in the bottom center of the screen and then ends either in the top-left or top-right corner. This might cause the weird behavior, as outlined in the following example: Let's say you have a trajectory the starts in the bottom center, then is slightly curved towards the right, and then moves towards an option at the top that is slightly left of the start position. In this case you get a positive MAD (as the deviation is considered to be "above" the idealized straight line). Now if the trajectory shape looks similar but the end position is slightly right of the start position, you get a negative MAD (as the deviation is now considered to be "below" the idealized straight line). In typical mouse-tracking experiments this does not occur as the options between a person is choosing are clearly left and right of the start position.

Best regards,

Pascal

• That makes sense!

I also have the 'normal' set up with two end points left and right (everything is equidistant from start). Would it make sense to align them in the same workflow first or analyze them as two distinct dataset and merge them at the end? I get vastly different results if I align them as one dataset or align this 'straight' line dataset. I've tried to look into the 'raw' code, but do not fully understand what the align package is doing.

I'll probably write a wrapper around mousetrap to analyze the 'straight line' in the end. Happy to share.

• The specific mt_align function only makes sense for trajectories that come from the same layout. The mt_align_start function could also work for trajectories from different layouts.

Yes, sharing the code you develop for the special case trajectories sounds great!