# Initial Angle of Trajectory

Hello Pascal,

I was wondering if the mousetrap package in R was capable of producing the initial angle of the trajectory. This is a metric I've seen in Coco and Duran, (2016). They define it as:

"(a) initial degree (the degree of deviation from vertical after the mouse trajectory leaves a 50-pixel radius from the starting point, same as Buetti and Kerzel (2009)), where positive values indicate angles towards the incorrect target"

Thanks for any help you can provide. The mousetrap package has been a huge boon to my research.

## Comments

Hi Mike,

we do not calculate it directly. However, the mt_angles function calculates the movement angle for every point of the trajectory, including a vertical based angle. If you find a way to filter the trajectory beforehand so it only contains the start point and the point for which you would like to determine the angle (and the end point), you could use it to get the initial movement angle.

Best,

Pascal (note: I am currently traveling for the next two weeks without steady internet access, so my replies might be a bit delayed)

Hi Pascal,

Thank you again for your assistance! I looked into the mt_angle function and was able to produce a plot and aggregated data. I just wanted to confirm that this workflow and output looks reasonable.

Once I've aggregated the data. Couldn't I just subset the df to the relevant time period (e.g., first 500 ms) to get the initial angle of movement across those timestamps?

Hi Mike,

the angle calculation looks fine to me.

The aggregated plot might be a bit misleading as it averages the values for each specific time point and if one trial only has a recorded position at say timestamp 501 ms it will not be reflected for the timestamp 500. One solution for this could be to use mt_resample before calculating the angle to ensure that the timestamps are identical across trials.

Afterwards, your code to only look at the first 500 ms is in principle fine in that it will give you the average angle for each timestamp separately for each condition if this is what you want to analyze.

Best

Pascal

Hi Pascal,

Thanks for the help and sorry for the late reply. I used the mt_resample function and I'm happy to say that nothing appeared to change because of it. I will keep this in mind for the future. Thank you!