Conditional trials sequence

PennController for IBEX Forums Support Conditional trials sequence

Tagged: 

  • This topic has 2 replies, 2 voices, and was last updated 4 years ago by Lynn.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5214
    Lynn
    Participant

    Hello Jeremy,

    I have been trying to find what I want in the shuffle sequence chapter of the manuals and in the support questions but I couldn’t.
    My question is : is it possible to run an order of trials depending on the answer on a question in the first one.
    i.e.:

    Intro trial:
    – Choose a letter : A – B – C
    – Validation button

    If they choose A or B as an answer –> the next trials will be T1N, T2N, T3N, T4N, T5N
    If they choose C as an answer –> the next trials will be T1, T2, T3, T4, T5

    Thank you very much in advance.
    Best regards,
    Lynn.

    #5215
    Jeremy
    Keymaster

    Hi Lynn,

    Unfortunately this kind of conditional sequence of trials is a feature that is not well supported in (PC)Ibex. The problem is that the sequence of trials is computed once, as soon as one opens the experiment’s page. Since you have to deal with a constant sequence of trials, one trick is to dynamically change the content of those trials.

    For example, you could do that:

    PennController.ResetPrefix(null)
    
    Sequence( "intro" , randomize(startsWith("T")) , "end" )
    
    newTrial( "intro" , 
      newVar("chosenletter", "").global()
      ,
      newScale("letter", "A","B","C")
        .labelsPosition("left")
        .before( newText("Choose a letter:") )
        .print()
        .wait()
        .setVar("chosenletter")
    )
    
    AddTable("myTable", `item,questionAB,correctAnswerAB,questionC,correctAnswerC
    1,What is the result of 2+2?,4,What is the result of 2*2?,4
    2,What is the result of 3+3?,6,What is the result of 3*3?,9`)
    
    trialAB = row => [
      newText(row.questionAB).print()
      ,
      newTextInput("inputAB", "")
        .print()
        .once()
        .wait()
        .test.text(row.correctAnswerAB)
        .success( newText("Good job!").print() )
        .failure( newText("Nope, sorry").print() )
      ,
      newTimer(1000).start().wait()
    ]
    
    trialC = row => [
      newText(row.questionC).print()
      ,
      newScale("sliderC", '1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
        .labelsPosition("top")
        .print()
        .once()
        .wait()
        .test.selected(row.correctAnswerC)
        .success( newText("Good job!").print() )
        .failure( newText("Nope, sorry").print() )
      ,
      newButton("Continue").print().wait()
    ]
    
    Template( "myTable" , row => 
      newTrial( "T"+row.item ,
        getVar("chosenletter").test.is("C")
          .success( ...trialC(row) )
          .failure( ...trialAB(row) )
      )
    )

    In this example the AB and C trials are almost the same, but of course you can code very different structures. Just keep in mind that all the commands of both the AB and C versions will technically be included in the trial, which means you should use unique names for your elements considering both variants. If you have two elements that share the same name, one in the AB and the other in the C version, then you will get unreliable behavior.

    Jeremy

    #5217
    Lynn
    Participant

    Hello Jeremy,

    Thank you a lot for this proposal and for your fast and helpful answers.

    Sincerely,
    Lynn.

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