Advanced Tutorial
The Advanced Tutorial is a continuation of the Basic Tutorial. You’ll learn how to use a table to create trial items, counterbalance, add an informed consent section, and more.
note
The Basic and Advanced Tutorials are a learning-by-doing introduction to PCIbex: you’ll learn how to use PCIbex by creating an actual experiment.
If you prefer learning things concept-by-concept, check out the understanding-oriented Core Concepts section!
Table of contents
- 8. Creating a trial template
- 9. Customizing an experiment
- 10. Counterbalancing
- 11. Collecting participant information
- 12. Examining data
- 13. Wrapping up
Objective
In the Advanced Tutorial, we’ll create a picture matching experiment with the following structure:
- Consent form trial:
- Checkbox to indicate consent
- Button to continue
- Instructions trial:
- Text input box for participants to enter their ID
- Button to start the experiment
- Four experimental trials:
- One-second delay.
- A sentence plays as audio and unfolds as text on the screen.
- Two images are printed to the screen next to each other.
- Participant clicks on an image or presses a key to select an image.
- Trial timeout (trial ends if the participant does not select an image before audio playback finishes).
- Exit screen
Preview the AdvancedTutorial experiment:
Click to see the final experiment script
// Type code below this line.
// Remove command prefix
PennController.ResetPrefix(null)
// Turn off debugger
DebugOff()
// Control trial sequence
Sequence("consent", "instructions", randomize("experimental-trial"), "send", "completion_screen")
// Consent form
newTrial("consent",
newHtml("consent_form", "consent.html")
.cssContainer({"width":"720px"})
.checkboxWarning("You must consent before continuing.")
.print()
,
newButton("continue", "Click here to continue")
.center()
.print()
.wait(getHtml("consent_form").test.complete()
.failure(getHtml("consent_form").warn())
)
)
// Instructions
newTrial("instructions",
defaultText
.cssContainer({"margin-bottom":"1em"})
.center()
.print()
,
newText("instructions-1", "Welcome!")
,
newText("instructions-2", "In this experiment, you will hear and read a sentence, and see two images.")
,
newText("instructions-3", "<b>Select the image that better matches the sentence:</b>")
,
newText("instructions-4", "Press the <b>F</b> key to select the image on the left.<br>Press the <b>J</b> key to select the image on the right.<br>You can also click on an image to select it.")
,
newText("instructions-5", "If you do not select an image by the time the audio finishes playing,<br>the experiment will skip to the next sentence.")
,
newText("instructions-6", "Please enter your ID and then click the button below to start the experiment.")
,
newTextInput("input_ID")
.cssContainer({"margin-bottom":"1em"})
.center()
.print()
,
newButton("wait", "Click to start the experiment")
.center()
.print()
.wait()
,
newVar("ID")
.global()
.set(getTextInput("input_ID"))
)
// Experimental trial
Template("items.csv", row =>
newTrial("experimental-trial",
newTimer("break", 1000)
.start()
.wait()
,
newAudio("audio", row.audio)
.play()
,
newTimer("timeout", row.duration)
.start()
,
newText("sentence", row.sentence)
.center()
.unfold(row.duration)
,
newImage("plural", row.plural_image)
.size(200, 200)
,
newImage("singular", row.singular_image)
.size(200, 200)
,
newCanvas("side-by-side", 450,200)
.add( 0, 0, getImage("plural"))
.add(250, 0, getImage("singular"))
.center()
.print()
.log()
,
newSelector("selection")
.add(getImage("plural"), getImage("singular"))
.shuffle()
.keys("F", "J")
.log()
.callback(getTimer("timeout").stop())
,
getTimer("timeout")
.wait()
)
.log("group", row.group)
.log("item", row.item)
.log("condition", row.inflection)
.log("ID", getVar("ID"))
)
// Send results manually
SendResults("send")
// Completion screen
newTrial("completion_screen",
newText("thanks", "Thank you for participating! You may now exit the window.")
.center()
.print()
,
newButton("wait", "")
.wait()
)