Howdy, Stranger!

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

Supported by

Selecting Data for mouse measures

Hi! Is there any easy way to pre-select data to make measures on before making any measures based on them?
Suppose I want to calculate total distance after a certain timestamp (e.g. after 600 ms since the start of the trial). Is there any (easy) way in Mousetrap library for it?
Thank you!

Comments

  • edited September 2019

    Hi!

    that is in principle possible, but the specific implementation depends on the measure you want to use.

    The following code gives an example how you can calculate the Euclidean distance traveled from the beginning of the trajectory until timestamp 600 (ms):

    # 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)
    
    # Demonstrate that sum of distances corresponds to total_dist measure
    table(rowSums(mt_example$trajectories[,,"dist"],na.rm=TRUE)-mt_example$measures$total_dist)
    
    # Set distances for timestamps beyond 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)
    

    Hope this helps. If you have any additional questions, feel free to ask!

    Best,

    Pascal

  • edited September 2018

    Thank you so much! It really does help!

    I have one additional question: how do I summarize these measures by subjID (and possibly, by some other factors)?

    thank you!

  • This is how I did it:

    average_measures <- mt_aggregate_per_subject(
      mt_data,
      use="measures",
      use_variables=c("total_dist_600"),
      subject_id="subjID"
    )
    
  • You can use the mt_aggregate_per_subject function for this. If you specify a condition variable in use2_variables, the measures will be summarized per participant and condition.

    average_measures <- mt_aggregate_per_subject(
      mt_example,
      use="measures",
      use_variables=c("total_dist_600 "),
      use2_variables="Condition",
      subject_id="subjID"
    )
    
    

    Best,

    Pascal

  • I have another question. Should I want to calculate other measures, like acceleration and velocity, will setting trajectories to zero be sufficient? In other words, if i want to calculate say velocity after certain time period, do I only need to change total_dist to vel_max?

    Thank you!

  • You would have to make a few changes:

    # Set velocities for timestamps beyond 600 ms to 0
    mt_example$trajectories[,,"vel"][mt_example$trajectories[,,"timestamps"]>600] <- 0
    
    # Calculate maximum velocity
    mt_example$measures$vel_max_600 <- apply(mt_example$trajectories[,,"vel"],1,max,na.rm=TRUE)
    

    Instead of the second line, you could also run mt_measures afterwards. It will automatically calculate the total_dist and vel_max based on the modified values, so the resulting values for total_dist an vel_max will be the ones for the first 600 ms.

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