Howdy, Stranger!

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

Supported by

[open] Cumultative Chance for a random event

edited June 2013 in OpenSesame

Hello Henrik again,

I wanted to know if there is a possibility to get a cumultative chance that a random event occurs.

Like the first time its 10% that the event during a trial occurs. If it doesnt occur the chance raises by 10%. So the second time the chance that it occurs is 20%.
If it doesnt occur again it goes up to 30% and so on. If it occurs the chance drops down to 10% for the next time trial.

So lets give an example:

Any time you make a choice, there is the chance that a random event happens. If you decide to take the car to get to a certain location, there is the chance to get in a traffic jam. Each time you choice the car i want it to get more likely that you end up in a traffic jam. Is there any chance to modul that?

Best regards,

Henrik

Comments

  • edited June 2013

    Hi Henrik,

    Sure, with a bit of scripting this type of thing can be implemented quite easily. However, it seems that you're describing two different scenarios:

    • The probability of an event is contingent on whether the event occurred before. (First example.)
    • The probability of an event is contingent on how often another (non-random) event has occurred before. (Traffic-jam example.)

    What exactly do you want to do?

    Cheers,
    Sebastiaan

  • edited 5:34PM

    Hi sebastiaan,

    Oh I see the problem, my bad. I want the first example. A random event that occurs with increasing chances depending on wether or not it has occured before.

    Best regards,

    Henrik

  • edited 5:34PM

    Ah, I see. Basically, you will want to maintain a variable, let's called it [prob], that specifies the probability that an event occurs. Each time that you determine (randomly) whether the event actually occurs, [prob] decreases when it does, and increases when it doesn't, as in the script below:

    from random import random
    
    # random() returns a number between 0 and 1
    # so this sets `event_occurs` to True or False
    # with a probability of [prob].
    prob = self.get('prob')
    event_occurs = random() < prob
    
    # If the event does not occur, increase the
    # probability for the next time, but not
    # higher than 1.
    if not event_occurs:
        prob += .1
        if prob > 1:
            prob = 1
    # If the event does occur, decrease the probability,
    # but not below 0.
    else:
        prob -= .1
        if prob < 0:
            prob = 0
    
    # Store [prob] and [event_occurs]
    exp.set('prob', prob)
    exp.set('event_occurs', event_occurs) # Will be set to 'yes' or 'no'
    

    This script assumes that [prob] has some kind of starting value. And, of course, it depends on the experiment what the logic will be, and how the variable [event_occurs] is used. But in general, this should get you started.

    Here you see the script in the context of a working dummy experiment:

    Cheers!
    Sebastiaan

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