Howdy, Stranger!

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

Supported by

Randomize 2 variables with several levels

Hello,

I am currently programming an experiment in which I want to present a list of 36 words. In this list, 12 words are positive, 12 negative and 12 neutral. I have another variable which is the value of the word (high vs low), which means that I want each word to be randomly paired with a number between 1 to 5 (low) or 8 to 12 (high). Additionnaly I need to counterbalance the proportion of high vs low value word between each emotionnal condition (half of positive words with high value and the other half with low value).

Is there any simple way of doing so ?

With E-Prime I used the nested lists functionnality, but I can't fin a way to easily programm my experiment with Open sesame.

Any idea would help :)

Comments

  • Hi @Naïde ,

    Since you have only ten numbers (and twelve words per emotion), I assume that you want to randomly sample from these numbers with replacement. If so, then it's actually quite easy, because you can simply create a loop table with three columns: word , emotion ('positive', 'negative', or 'neutral'), and value ('high' or 'low'). Then at the start of the trial sequence, you insert an inline_script with a short piece of code in the prepare phase to actually set the number variable, like so:

    import random
    if value == 'low':
        number = random.randint(1, 5)
    else:
        number = random.randint(8, 12)
    

    Does that make sense?

    — Sebastiaan

  • Hi @sebastiaan

    Thank you very much for your help. The code works perfectly to randomly assign a number. The problem is that I also want to randomize the high / low value for the words. For instance I want the first positive word to be either low or high value across participants.

    I tried to creat one loop table with 3 columns corresponding to the 3 emotional conditions (positive / negative / neutral), and then a sub loop table with a full factorial design leading to 6 conditions (positive-high, positive-low, neutral-high, neutral-low, negative-high, negative-low).

    Before these loops I placed the following inline_script to define the value (high/low) and randomize the numbers

    import random

    low=random.randint(0,5)

    high=random.randint(8,12)


    Now I would like to

    1/ randomly assign a value high or low to each word

    2/ counterbalance the proportion of high / low value words within each emotional condition (e.g. 50% of positive word with high value and 50% with low value)

    I tried to import pseudorandom tu use the constrain function but it doesn't work. Opensesame indicates that pseudorandom is imported but not used.

    I am sorry for these basic questions, I am a new user of opensesame and not familiar with Python (it took me a while to figure out how I could import the random plugin...)


    Again, thanks a lot for your answer and your help :)

  • Hi,

    See attached experiment for a demo how you can accomplish this with Python coding.

    Essentially I create the stimuli once per block, and then access them one by one in the trials. When doing that that I get 36 words, 12 in each valence condition and of these 12, 6 with a high number and 6 with a low one. That's what you want, right?

    Eduard

    Buy Me A Coffee

  • Hi @eduard

    Your programm is wonderful, the randomization is perfect !!

    Thank you so much for your help ! 😀

    The only issue I have now is that among the 12 words of each valence condition, some are presented several times while some do not appear. Is there a way to tell the programm that once a word has been presented it must not be presented again in the following block ?


  • @eduard

    Finally it works perfectly for me, you saved me a lot of precious time !

    Thanks again !

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