Random Ratio schedule

MEDState Notation Repository Forums Coding Help Archive Random Ratio schedule

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15726
    natdiam
    Participant

    Hi,
    I am trying to set up a basic two lever instrumental conditioning task but I am new to MedState Notation (and coding in general) and I have no idea how to set a random ratio schedule for rewards (a 0.2 probability for example). Any suggestions will be highly appreciated!
    Many thanks,
    Natasha

    #15729
    Med_Support
    Moderator

    Hello Natasha,

    I am including a sample code below that should give you a basic guide on how to do a random ratio schedule.

    Below you will see I have made a list Z. I have included 5 elements in Z to show the .2 probability you mentioned.
    I am using the variable A to represent the number picked randomly from List Z.

    Med PC uses two different functions for random operations, RANDD and RANDI. The difference between the two is that RANDD does not use replacement, but will randomly pick a number from a list and then that number won’t be picked again until every number on the list has been picked.

    RANDI will randomly pick a number from the list and then put it back into the list where it can be chosen again.

    The sample code below begins with a #START command, then moving into S2 where 1 second passes and then the RANDI function makes the variable A equal to a number randomly picked from Z. We then move to S3 where the code waits for a certain number of left lever presses dictated by whatever number A is.

    After that many presses, a Z1 pulse is created. In this, I made Z1 be what would distribute the reward. In State Set 2, I added a line that waits for the reward to be given before updating a show field that displays how many times a reward has been given.

    ^LeftLever = 1

    \ A = Ratio Value Drawn from List Z
    \ Z() = Variable Ratio Array

    \ Z Pulse
    \ Z1 = Reward Output
    LIST Z = 1, 2, 3, 4, 5

    S.S.1
    S1,
    #START: —> S2

    S2,
    1″: RANDI A = Z —> S3

    S3,
    A#R^LeftLever: Z1 —> S2

    S.S.2
    S1,
    #Z1: ADD X; SHOW 1, Rewards Issued, X —> S1

    You can also find a more in depth explanation of how RANDD and RANDI work in the MED-PC Programmer’s Manual found in the Manuals section of our website. The manual also includes a step by step tutorial that would help you familiarize yourself with some of the more common functions of Med State Notation.

    #15777
    natdiam
    Participant

    Thank you very much for the code and the explanation. I definitely got the idea now.
    I am trying to add these lines to my main code. Hopefully it works.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.