Howdy, Stranger!

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

Supported by

Initial acceleration?

Hi!

I have been using mousetrap plugin for a while and it is sooo awesome. I am trying to study the influence of proactive inhibition on mouse movement. Could you please help me with devising a way to calculate initial acceleration? I.e. acceleration on the first recorded section of the trajectory?


Thank you!

Comments

  • Hi,

    glad to hear that you like the mousetrap software packages! :)

    How would you specifically like to define "acceleration on the first recorded section of the trajectory"?

    That is, what is the first recorded section? The first XXX ms? Or the first XX percent of the trial?

    And how would you like to compute the acceleration of the section? The average acceleration in that section? The maximum acceleration that occurred anywhere in this section?

    Best

    Pascal

  • What I have in mind is first 25% of trajectory. Is it possible to compute maximum AND averafe acceleration on this part?

  • I have another (tangentially related) question. In one of the previous theme (long ago) you provided the way to calculate the distance after certain amount of time (for example). Is there any way to make it trial by trial?

    In our stop-signal task, the stop signal sounded after a delay that was set using a staircase procedure in each trial. Suppose we want to calculate distance that an individual went in each stop trial after hearing a stop-signal. Is there a way to calculate this given the stop-signal delay in a given trial(i.e., individually for each trial).


    Thank you in advance!

  • Hi,

    I just realized that I forgot to answer the two questions you posted a while ago, sorry for that! What is the current status concerning your questions? Are they still up to date?

    Best,

    Pascal

  • Hi again! Yes they are.


    Best, Anton

  • Hi Anton,

    regarding your first question ("What I have in mind is first 25% of trajectory. Is it possible to compute maximum AND averafe acceleration on this part?"):


    I think there are two ways how you could to do this (not sure which way is best). I'll illustrate both ways with R scripts that use the example data in mousetrap. Please note that this is just an illustration how you can implement it on a technical level - I have not thought thoroughly about whether this procedure makes sense in practice.


    First variant:

    Time normalize trajectories first, the calculate the acceleration for each point and then aggregate (manually via the apply function) over the first 25 % of values per trial:

    # time normalize trajectories
    mt_example <- mt_time_normalize(mt_example)
    
    # calculate acceleration (and velocity) for time normalized trajectories
    mt_example <- mt_derivatives(mt_example,use="tn_trajectories")
    
    # calculate measures (not really necessary, I just do it to add the measures data.frame)
    mt_example <- mt_measures(mt_example, use="tn_trajectories")
    
    # calculate maximum acceleration for first 25 % of time normalized trajectories
    mt_example$measures$acc_max_25percent <-
     apply(mt_example$tn_trajectories[,1:25,"acc"],1,max)
    
    # calculate mean acceleration for first 25 % of time normalized trajectories
    mt_example$measures$acc_mean_25percent <-
     apply(mt_example$tn_trajectories[,1:25,"acc"],1,mean)
    

    Second variant:

    Calculate the acceleration for each point in the raw trajectories, time normalize trajectories afterwards and then aggregate (manually via the apply function) over the first 25 % of values per trial:

    # calculate acceleration (and velocity) for time normalized trajectories
    mt_example <- mt_derivatives(mt_example)
    
    # calculate measures (not really necessary, I just do it to add the measures data.frame)
    mt_example <- mt_measures(mt_example)
    
    # time normalize trajectories
    mt_example <- mt_time_normalize(mt_example,dimensions = c("xpos","ypos","acc"))
    
    # calculate maximum acceleration for first 25 % of time normalized trajectories
    mt_example$measures$acc_max_25percent <-
      apply(mt_example$tn_trajectories[,1:25,"acc"],1,max)
    
    # calculate mean acceleration for first 25 % of time normalized trajectories
    mt_example$measures$acc_mean_25percent <-
      apply(mt_example$tn_trajectories[,1:25,"acc"],1,mean)
    

    Both variants might lead to different results as you look at the trajectory with a different resolution (which can make a difference especially for acceleration values that can be quite volatile).


    Best,


    Pascal

  • Regarding the second question ("In our stop-signal task, the stop signal sounded after a delay that was set using a staircase procedure in each trial. Suppose we want to calculate distance that an individual went in each stop trial after hearing a stop-signal. Is there a way to calculate this given the stop-signal delay in a given trial(i.e., individually for each trial)."):

    As you wrote I think that this relates back to another discussion we had some time ago here: http://forum.cogsci.nl/discussion/comment/14531/#Comment_14531

    You could modify the code there a bit:

    # Load mousetrap library
    library(mousetrap)
    
    # Calculate mouse-tracking derivatives for each position (distance, velocity, acceleration)
    mt_example <- mt_derivatives(mt_example)
    
    # Calculate standard mouse-tracking measures
    mt_example <- mt_measures(mt_example)
    
    # Set distances for timestamps before 600 ms to 0
    mt_example$trajectories[,,"dist"][mt_example$trajectories[,,"timestamps"]<600] <- 0
    
    # Calculate sum of distances for timestamps >= 600 ms as a new measure in mt_example$measures
    mt_example$measures$total_dist_600 <- rowSums(mt_example$trajectories[,,"dist"],na.rm=TRUE)
    

    Assuming you have a trial variable that contains the time at which the sound occurred in a given trial which is stored as "threshold" in mt_example$data, you could modify the code even further

    # Load mousetrap library
    library(mousetrap)
    
    # Calculate mouse-tracking derivatives for each position (distance, velocity, acceleration)
    mt_example <- mt_derivatives(mt_example)
    
    # Calculate standard mouse-tracking measures
    mt_example <- mt_measures(mt_example)
    
    # Set distances for timestamps before individual threshold to 0
    for (id in mt_example$data$mt_id){
      mt_example$trajectories[id,,"dist"][
        mt_example$trajectories[id,,"timestamps"]<mt_example$data[id,"threshold"]
      ] <- 0
    }
    
    # Calculate sum of distances for timestamps >= threshold as a new measure in mt_example$measures
    mt_example$measures$total_dist_thre <- rowSums(mt_example$trajectories[,,"dist"],na.rm=TRUE)
    

    Hope this helps!

  • Thank you soo much! that does indeed help!

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games