Howdy, Stranger!

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

Supported by

Assigning participants to different loops in OSWeb

Hi there,

I used OSWeb for an experiment last year and my solution worked just fine, but now it doesn't work.

I've got 2 experimental conditions/lists that I realized by creating different loops, and I would like to randomly assign my participants to one of these 2 conditions. 

The solution I'm using is inline Javascript:

if(vars.subject_nr%2==0) {
vars.subject_group = 'A'
} else {
vars.subject_group = 'B'
console.log('subject_group', vars.subject_group)

+ adding subject_group = 'A' to the "run if" of one loop and = 'B' to the "run if" of the other.

The experiment has a first part with a questionnaire which seems to be working just fine, but then the page goes blank and participants are not directed to either of the loops.

Is it because my inline code messes with the new set_subject_nr(nr)? How do I make it work?

Also, minor: now that the log all variables is not allowed in OSWeb anymore, how do I add a custom variable to the logger for keyboard responses to my sketchpads? I am not interested in RTs, just in the responses, but I don't see where I can rename the response variable to make sure it's logged. I'm sorry I'm such a newbie ahah. I'll buy coffee to whoever helps 🙈



  • Update: I tried deleting the inline code and putting just

    vars.subject_parity = 'even'

    in the "run if" section of one loop and 'odd' in the "run if" section of the other but it doesn't work either.

  • FabFab
    edited November 2021

    Hi @ellie,

    You could use Javascript code but in your case, you don't strictly need it. If you set up OSWeb to pick randomly a subject number between 0 and 1, you can use the subject_nr variable to condition the presentation of a loop.

    Here's how to condition the presentation of a loop to subjects 0 or 1:

    Now, if you do want some dummy variable to save a condition label, you can do so too, using code, and include that variable in the list of logged variables. You can insert that code early in the program:

    if (vars.subject_nr==0) {
    } else {

    To insert the vars.subbject_group in the list of logged variables, you need to add it as a custom variable (by definition, a variable you created through code is not one that Open Sesame's automatically created variables and so it won't show in the variables inspector):

    As for saving the response in each trial, if you have a single keyboard event, the response is saved in vars.response (and the RT in vars.response_time). The score (0/1) is saved in vars.correct. In the example above, the keyboard object is called kb_response. You'll see that a vars.kb_response and vars.kb_response_time are created by OS. I've included these in the log so that you can see that in this case, they store the same information as vars.response and vars.response_time.

    I attach a basic task with the above so that you can see it working:

    Now, note that since we created a vars.subject_group variable, we could also use that one to condition the presentation of the loop. Not sure why it does not work in your example, but it might because you only you call upon that variable before it is defined (hard to tell without seeing your program).

    In the my example, I set up the vars.subject_group early on, ahead of the meta_sequence that contains loops A and B:

    So, if you wanted, you could then use that variable to set the "run if" parameters inside the meta_sequence:

    It achieves the same as the first method.

    Here's a version using vars.subject_group:

    Hope this helps!



    Buy Me A Coffee

  • Thank you so much @Fab, it seems to be working now.

    I still had to duplicate the logger in order to have all of the responses, though the software seem to advise against it. Well deserved coffee coming your way!



  • Hi @ellie,

    Glad it now works and many thanks for the ☕️!

    Duplicating the logger isn't an issue if you're talking about creating a linked copy of the logger (linked copies of an object refer to the same object), but creating two distinct loggers might mess things up.

    Good luck with your experiment!


    Buy Me A Coffee

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 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