Howdy, Stranger!

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

Supported by

N-back

I am a Python beginner so please forgive the noob question. How do I code the instruction "N trials ago". I need to tell Python that if the target letter displayed now is the same as that displayed N trials ago, then the user should press a key. Any hints on how to code that?

Comments

  • Hi,

    It depends on whether the distance between the first and the final target is something you want to be random, or rather fixed (like 4 different values for N). In case of the latter, N should be one of the experimental variables declared in your loop item. In case of a random value for N, you'll need an inline_script. Let me know which one it is (and whether you already have the means to display both stimuli at your desired moments; (if so, please describe your method)).

    Cheers,

    Josh

  • Hi Josh,

    thanks for your answer. N should be fixed. I have a variable "target_digit" that displays digits 1 to 9 randomly. I just need to code the correct response, so that the user has to press a key only if the same digit was displayed N trials ago.

  • Alright!

    In this case it would be good to have a variable like target_same in your loop item, with two possible values, yes and no.
    You can insert two target sketchpads in your sequence, one of which would be displayed if target_same is yes, and the other when target_same is no. Needless to say, one of these needs to have the same digit, and the other a random other digit. To display only one of these, you can click on your sequence item to see run-if statements for all items contained by the sequence. For one of the target sketchpads, you enter [target_same] = yes, for the other [target_same] = no.

    You then need to apply the same logic to a keyboard item (or whatever it is you collect a response with). One of the keyboards has a keypress as the correct response, the other has 'none' as the correct response.

    Let me know if this works.

    Cheers,

    Josh

  • Let me try to see if I understood you correctly. I have two target variables. One contains the same number (e.g. 1,1,1,1,1,1,1,1,1) and the other a sequence of different numbers(e.g. 1,2,3,4,5,6,7,8,9). Then I got another variable (target_same) calling the first sequence once every N trials (no, no,yes,no,no,yes). Then I play this in random order. Since we have 9 digits, this will result in the same digit being displayed N trials ago in 1 out of 9 trials.Fine. But I do not understand how to code the correct response. The digits in the random sequence will be called randomly so there is no way of coding a correct response ex ante (using a "correct_response") variable.

  • Well, I ended up adopting a much simpler (but less smart) solution. I generated a random sequence at random.org and then I created a "correct_response" variable, and inserted the correct response manually. One problem is this: How do I specify that the correct response is to not press any key?Like instead of typing the key ("s"), what shall I type?

  • Hi, I've checked, and you need to enter None as the correct response, not 'none' like I said earlier. Sorry about that! In the allowed response box, you could enter None;s (in case the desired allowed keypresses would be 's' and no keypress). One additional thing is that you need to enter a time-out.

    Cheers

    Josh

  • Great! It works

  • Hello! I'm working on an n-back as well (auditory) where my n value is fixed (= 1). I've done my best to follow what you've outlined above and have defined the following variables in my loop:

    "target_name" lists all of my acoustic stimuli.

    "correct_response" has two levels, LEFT for if the sound presented is the same as the one immediately before it and none if they are different.

    "target_same" has two levels, yes and no.

    And lastly, "n_value" has just a single level-- 1.

    I have two questions as of now: I've noticed that the variable table in the loop lists more combinations of outcomes than I desire. For example, it lists the combinations "target_same"= yes/"correct_response" = none, and "target_same" = no/"correct_response" = LEFT. Will simply deleting those undesired rows in the table be sufficient? Also, in your discussion above regarding creating two sketchpads in the sequence (each being displayed as a result of a run-if statement), must you create two separate keyboard responses that each apply to a single sketchpad?

    Thank you for taking the time to read!

  • edited November 2016

    Hi!

    1) Yes, deleting the undesired rows will be sufficient (be sure to move the rest up and set the correct number of cycles though).

    2) Well, there are multiple ways of doing things. If you have a correct_response variable in your loop item, then you could just use one keyboard item where you leave the correct response box empty.

    Cheers,

    Josh

  • Thanks so much, Josh! I'll give that a try.

  • Josh,

    Right now, it seems like the program is simply playing a randomized stream of stimuli, some of which repeat and most of which do not. I have two sketchpads (rather, sampler items because I'm using acoustic stimuli) and have defined the variables and responses discussed above, but there seems to be some disconnect between the two such that the n-back idea isn't really being implemented. My goal is to code for a set number of repeats (though randomized in nature) for each block of trials. Do you have any suggestions as to what I should make sure is in place?

    Thanks again,
    Kate

  • Kate,

    try my version of N-back (attached) and let me know if this is what you desire. It's not auditory, but visual. However, this could easily be changed.

  • @Daxide - thank you for sharing! Very helpful to see someone else's implementation. I see that your block of targets is sequential, making it possible to code what each correct response should be. I was hoping to present my stimuli in a randomized fashion, while still predetermining a set number of "repeats" (since n=1) for each block of trials.

    I also have realized that I have not yet done the random number generating, so I'll work on getting that set up.

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