Howdy, Stranger!

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

Supported by

[open] Simultaneously storing two Pseudo-probabilities

edited August 2014 in OpenSesame

Hello all, first of all thank you Sebastiaan & Co. for this wonderful nifty program and the community that comes with it :)>- . I have recently began to build experiments with probabilities and am stumped on how to keep two pseudo-probabilities at the same time. I will try to be as clear as possible, using a cat example.

There are two buttons, when clicking on the left button a picture of either a Male or Female cat will appear, the same for the right button.

-However, the left button has a .75 probability of displaying the same gender of cat on subsequent trials as the previous trial (if male -> .75 it is male once left button is selected again and .25 it is female, if next trial is female(.25) then -> .75 female, .25 male for next trial etc. repeating throughout depending on which gender cat is [pseudo]randomly selected)

-Simultaneously, the right button has a .25 probability of displaying the same gender of cat on subsequent trials as the previous trial (if male -> .25 it is male once right button selected again and .75 it is female. following the same pattern as the other button but with inverted probabilities)

The trouble I am having: Having the male or female cats being selected from the picture pool with the (2)probabilities changing. I assume I have to create a list and store the previous probability and then retrieve that specific probability (either 1 or 2) corresponding to the buttons.

Let me know if I am not being clear, or if I am going about the methods all wrong. I appreciate feedback, thank you for reading.

-Felix

Comments

  • edited 6:28PM

    Hi Felix,

    That's an interesting problem, with many possible solutions. Here's one:

    First, at the start of the experiment, you assign a starting probability of a male cat. You can do this with a simple inline_script like this (in the prepare phase):

    # Starting probability of showing a male cat
    p_male = .5
    

    Next, at the start of each trial, you choose a male or a female, based on this probability. If you have chosen a male, you set p_male to 1 (i.e. a male for sure), otherwise to 0 (i.e. certainly no male). You also set the experimental variable gender, which you can use to select the appropriate pictures from the file pool (e.g. cat_[gender]_1.png in OpenSesame script). This should be in the prepare phase of an inline_script at the start of a trial.

    import random
    # random.random() gives a random float between 0 and 1
    if random.random() <= p_male:
        p_male = 1
        exp.set('gender', 'male')
    else:
        p_male = 0
        exp.set('gender', 'female')
    

    Finally, after you have collected a response, you re-determine p_male, based on whether a switch is likely or not. This should be in the run phase of an inline_script at the end of a trial.

    # In this example, a left response means probably switch and a right
    # response means probably stay. This should be changed depending
    # on what kind of responses you collect.
    if self.get('response') == 'left':
        switch_likely = True
    elif self.get('response') == 'right':
        switch_likely = False
    else:
        raise Exception('Invalid response!')
    
    # If a switch is like, we subtract the current p_male, which is always 0 or 1
    # from .75, and take the absolute value. This works, because
    # abs(.75-0) == .75 -> From certainly no male to probably male
    # abs(.75-1) == .25 -> From certainly male to probably no male
    if switch_likely:
        p_male = abs(.75-p_male)
    # ... and analogously for a probable stay...
    else:
        p_male = abs(.25-p_male)
    
    # Some debugging output to make sure that things work as expected
    print '%s, %f' % (switch_likely, p_male)
    

    Does that make sense? If think (something like) this should work.

    Cheers!
    Sebastiaan

  • edited 6:28PM

    Yes! that does indeed make sense, I will implement it asap.

    Thank you for the 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